Spaces:
Sleeping
Sleeping
Download Dockerfile from DavidRambeau/happytrain_back: direct link, hf CLI and curl.
- Browser
- Download file 1.07 kB
-
https://huggingface.co/spaces/DavidRambeau/happytrain_back/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/DavidRambeau/happytrain_back/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/DavidRambeau/happytrain_back/resolve/main/Dockerfile
1.07 kB
| # ββ Stage 1: Builder ββββββββββββββββββββββββββββββββββββββββββ | |
| FROM python:3.12-slim as builder | |
| WORKDIR /app | |
| # Install dependencies | |
| RUN pip install --upgrade pip | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir --user -r requirements.txt | |
| # ββ Stage 2: Runtime βββββββββββββββββββββββββββββββββββββββββ | |
| FROM python:3.12-slim | |
| WORKDIR /app | |
| # Copy Python dependencies from builder | |
| COPY --from=builder /root/.local /root/.local | |
| # Copy application code | |
| COPY . . | |
| # Set environment variables | |
| ENV PATH=/root/.local/bin:$PATH \ | |
| PYTHONUNBUFFERED=1 \ | |
| DB_PATH=/data/gtfs_sncf.db | |
| # Expose port | |
| EXPOSE 7860 | |
| # Health check | |
| HEALTHCHECK --interval=30s --timeout=10s --retries=3 --start-period=15s \ | |
| CMD python3 -c "import urllib.request; urllib.request.urlopen('http://localhost:7860/health')" | |
| # Run FastAPI application | |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] |