Spaces:
Running
Running
| # 1. Use Hugging Face recommended Python image | |
| FROM python:3.12.8-slim | |
| # 2. Create non-root user (required by Hugging Face Spaces) | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV PATH="/home/user/.local/bin:$PATH" | |
| # 3. Set working directory | |
| WORKDIR /app | |
| USER root | |
| # 4. Install system dependencies | |
| RUN apt-get update && \ | |
| apt-get install -y --no-install-recommends \ | |
| curl \ | |
| pandoc && \ | |
| rm -rf /var/lib/apt/lists/* | |
| USER user | |
| # 5. Copy requirements first for caching | |
| COPY --chown=user requirements.txt . | |
| # 6. Upgrade pip & install Python dependencies | |
| RUN python -m pip install --upgrade pip \ | |
| && pip install --no-cache-dir -r requirements.txt | |
| # 7. Copy the rest of the app code | |
| COPY --chown=user . . | |
| # 8. Expose Hugging Face default port | |
| EXPOSE 7860 | |
| # 9. Run Uvicorn server for FastAPI app (main.py is in the root of the processor directory) | |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"] | |