FROM python:3.11-slim # Install system dependencies RUN apt-get update && apt-get install -y \ build-essential \ curl \ git \ && rm -rf /var/lib/apt/lists/* # Create non-root user (required by HF Spaces) RUN useradd -m -u 1000 user ENV HOME=/home/user \ PATH="/home/user/.local/bin:$PATH" WORKDIR /app # Copy requirements first to leverage Docker cache COPY --chown=user requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy the entire application COPY --chown=user . . # Switch to non-root user USER user # Expose the port Hugging Face expects EXPOSE 7860 # Run the orchestration script CMD ["python", "main.py"]