Spaces:
Running
Running
| # ============================================ | |
| # Virtual Foreman — Backend Dockerfile | |
| # Target: Hugging Face Spaces (Docker SDK) | |
| # Port: 7860 | |
| # ============================================ | |
| FROM python:3.11-slim | |
| # System deps for python-docx-template (requires zip/unzip) | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| gcc \ | |
| curl \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Set working directory (HF Spaces expects /code or /app; we use /code as recommended) | |
| WORKDIR /code | |
| # Install Python deps first (cache layer) | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir --upgrade pip && \ | |
| pip install --no-cache-dir -r requirements.txt | |
| # Copy application source | |
| COPY ./app ./app | |
| COPY ./templates ./templates | |
| # Expose HF Spaces default port | |
| EXPOSE 7860 | |
| # Health check (optional, HF may ignore) | |
| HEALTHCHECK --interval=30s --timeout=10s --start-period=20s \ | |
| CMD curl -f http://localhost:7860/health || exit 1 | |
| # Run via uvicorn | |
| CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"] | |