| # Use an official Python runtime as a parent image | |
| FROM python:3.9-slim | |
| # Set the working directory | |
| WORKDIR /app | |
| # Copy everything into /app | |
| COPY . /app | |
| # Install dependencies | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Expose default Spaces port | |
| EXPOSE 7860 | |
| # Run the application using Gunicorn | |
| # Hugging Face sets $PORT automatically | |
| CMD ["sh", "-c", "gunicorn -w 4 -b 0.0.0.0:${PORT:-7860} app:app"] | |