FROM python:3.12.3 # Create non-root user with UID 1000 RUN useradd -m -u 1000 user USER user ENV PATH="/home/user/.local/bin:$PATH" WORKDIR /app # Copy requirements and install COPY --chown=user requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy app code COPY --chown=user app/ app/ # Expose port 7860 (used by HF Spaces) EXPOSE 7860 # Run FastAPI with uvicorn on the required port CMD ["python3", "-m", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]