FROM python:3.9-slim WORKDIR /app # Install dependencies first (to cache this layer) COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Pre-download the model so it's baked into the image # This prevents the container from downloading it at runtime RUN python -c "from transformers import pipeline; pipeline('sentiment-analysis', model='distilbert-base-uncased-finetuned-sst-2-english')" COPY . . CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]