| # Use official Python 3.10 image | |
| FROM python:3.10-slim | |
| # Set working directory in container | |
| WORKDIR /app | |
| # Copy requirements first (for caching) | |
| COPY requirements.txt . | |
| # Upgrade pip and install dependencies | |
| RUN python -m pip install --upgrade pip | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy app folder and saved model | |
| COPY app ./app | |
| COPY saved_model ./saved_model | |
| # Expose FastAPI default port | |
| EXPOSE 8000 | |
| # Set default command to run FastAPI via uvicorn | |
| CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"] | |