File size: 485 Bytes
e5067f3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8bff115
 
 
e5067f3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
FROM python:3.10-slim

# HuggingFace Spaces requires non-root user with UID 1000
RUN useradd -m -u 1000 user
WORKDIR /home/user/app

# Install dependencies first (layer caching)
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy application code
COPY --chown=user app.py .

USER user

EXPOSE 7860

ENV TRANSFORMERS_VERBOSITY=error
ENV HF_HOME=/home/user/.cache/huggingface

CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]