Spaces:
Running
Running
| # Use a slim Python image for a smaller footprint | |
| FROM python:3.11-slim | |
| # Set environment variables | |
| ENV PYTHONUNBUFFERED=1 \ | |
| PYTHONDONTWRITEBYTECODE=1 \ | |
| PORT=7860 | |
| # Create a non-root user (Hugging Face requirement) | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| WORKDIR $HOME/app | |
| # Copy requirements first to leverage Docker cache | |
| COPY --chown=user requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy the rest of your code and the database | |
| # Ensure ttc_gtfs.duckdb is in your root folder | |
| COPY --chown=user . . | |
| # Hugging Face Spaces expects port 7860 | |
| EXPOSE 7860 | |
| # Run uvicorn | |
| CMD ["uvicorn", "src.app:app", "--host", "0.0.0.0", "--port", "7860"] |