| # Use official Python image | |
| FROM python:3.12.4-slim | |
| # Set environment variables | |
| ENV PYTHONDONTWRITEBYTECODE=1 \ | |
| PYTHONUNBUFFERED=1 | |
| # Set work directory | |
| WORKDIR /code | |
| # Install Python dependencies | |
| COPY requirements.txt ./ | |
| RUN pip install --upgrade pip && pip install -r requirements.txt | |
| # Copy project | |
| COPY . . | |
| # Expose port for Hugging Face Spaces (default: 7860 or 8000) | |
| EXPOSE 7860 | |
| EXPOSE 8000 | |
| # Set the command to run the FastAPI app with uvicorn | |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] | |