| # Use an official lightweight Python runtime as a parent image | |
| FROM python:3.9-slim | |
| # Set the working directory inside the container | |
| WORKDIR /app | |
| # Copy requirements file first to take advantage of Docker caching | |
| COPY requirements.txt /app/ | |
| # Install the Python dependencies | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy all project files into the container | |
| COPY . /app | |
| # Hugging Face Spaces requires the container to bind to port 7860. | |
| # The PORT environment variable is automatically set to 7860 by Hugging Face. | |
| # We run Uvicorn, pointing to app:app (Starlette instance) | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |