File size: 935 Bytes
4435a4a
0d8f750
4435a4a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10c7644
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Use a lightweight Python base
FROM python:3.10-slim

# Create a non-root user
RUN useradd -m -u 1000 user
USER user

# Add pip binaries to PATH
ENV PATH="/home/user/.local/bin:$PATH"

# Set working directory inside container
WORKDIR /

# Copy requirements and install as non-root user
COPY --chown=user ./requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt

# Copy project files into container
COPY --chown=user . /

# Run FastAPI app with Uvicorn on port 7860
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]

# Add this before `CMD` in Dockerfile
RUN python -c "from transformers import pipeline; pipeline('zero-shot-classification', model='joeddav/xlm-roberta-large-xnli')"
RUN python -c "from transformers import AutoTokenizer, AutoModelForSeq2SeqLM; AutoTokenizer.from_pretrained('google/flan-t5-base'); AutoModelForSeq2SeqLM.from_pretrained('google/flan-t5-base')"