| # Use a lightweight Python base image | |
| FROM python:3.9-slim-buster | |
| # Set the working directory in the container | |
| WORKDIR /app | |
| # Copy requirements.txt and install dependencies first | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy your model directory | |
| COPY model ./model | |
| # Copy your FastAPI application code | |
| COPY app.py . | |
| # Set the port that the application will run on inside the container | |
| ENV PORT 7860 | |
| EXPOSE ${PORT} | |
| # Command to run your FastAPI application with Uvicorn | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |