# Use Python slim image FROM python:3.10-slim # Set environment variable to avoid /.cache permission error ENV TRANSFORMERS_CACHE=/tmp/hf_cache # Set working directory WORKDIR /code # Install dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Pre-download Hugging Face model (optional but recommended) RUN python -c "from transformers import pipeline; pipeline('summarization', model='philschmid/bart-large-cnn-samsum')" # Copy app code COPY ./app ./app # Expose port EXPOSE 7860 # Run FastAPI app CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]