| FROM python:3.9-slim | |
| # Set the working directory inside the container | |
| WORKDIR /app | |
| # Copy dependency file first (better layer caching) | |
| COPY requirements.txt . | |
| # Install dependencies without cache | |
| RUN pip install --no-cache-dir --upgrade -r requirements.txt | |
| # Copy the rest of the code | |
| COPY . . | |
| # Environment variable for Hugging Face Spaces (or Docker run) | |
| ENV PORT=7860 | |
| # Expose the port | |
| EXPOSE $PORT | |
| # Start the Flask app using Gunicorn with 4 worker processes | |
| # - "app:extraaLearn_predictor_api" → app.py has Flask instance named extraaLearn_predictor_api | |
| CMD ["gunicorn", "-w", "4", "-b", "0.0.0.0:7860", "app:extraaLearn_predictor_api"] | |