Spaces:
Running
Running
| # Use a lightweight Python image | |
| FROM python:3.11-slim | |
| # Set the working directory inside the container | |
| WORKDIR /app | |
| # Copy the requirements file first to leverage Docker caching | |
| COPY requirements.txt . | |
| # Install dependencies | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy the rest of your application code | |
| COPY . . | |
| # Hugging Face Spaces specifically listens on port 7860 | |
| ENV PORT=7860 | |
| EXPOSE 7860 | |
| # Start the FastAPI app using uvicorn | |
| # We use 0.0.0.0 so it's accessible outside the container | |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] |