| # Hugging Face Spaces — FastAPI backend | |
| # HF Spaces requires the app to run on port 7860 | |
| FROM python:3.11-slim | |
| # Set working directory | |
| WORKDIR /code | |
| # Install dependencies | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy app code | |
| COPY . . | |
| # Create a writable directory for SQLite DB | |
| RUN mkdir -p /data && chmod 777 /data | |
| # Set env so DB writes to /data (persistent-ish volume on HF) | |
| ENV DB_PATH=/data/evolve.db | |
| # HF Spaces requires port 7860 | |
| EXPOSE 7860 | |
| # Start the FastAPI app | |
| CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"] | |