File size: 592 Bytes
129af3b
 
b17c737
 
 
 
 
 
129af3b
 
8697756
b17c737
 
 
8697756
129af3b
 
 
8697756
 
129af3b
c33fdae
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

# Set up a user with proper permissions
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user
ENV PATH="/home/user/.local/bin:$PATH"

WORKDIR /app

# Set cache directory for Hugging Face models
ENV TRANSFORMERS_CACHE=/home/user/.cache/huggingface
RUN mkdir -p /home/user/.cache/huggingface && chown -R user:user /home/user/.cache

# Copy and install requirements first to leverage caching
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy all project files
COPY . .

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