Spaces:
Sleeping
Sleeping
| # HuggingFace Spaces — Docker backend | |
| # Port 7860 is the required default for HF Spaces | |
| FROM python:3.10-slim | |
| # Create non-root user (HF Spaces requirement) | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV PATH="/home/user/.local/bin:$PATH" | |
| WORKDIR /app | |
| # Copy and install dependencies first (Docker layer caching) | |
| COPY --chown=user requirements.txt . | |
| RUN pip install --no-cache-dir --upgrade pip && \ | |
| pip install --no-cache-dir --extra-index-url https://download.pytorch.org/whl/cpu \ | |
| -r requirements.txt | |
| # Copy app files | |
| COPY --chown=user . . | |
| # Expose HF Spaces default port | |
| EXPOSE 7860 | |
| # Start FastAPI server | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |