FROM python:3.10-slim # Set up user with UID 1000 to comply with Hugging Face Spaces security RUN useradd -m -u 1000 user USER user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH \ PYTHONPATH=/home/user/app WORKDIR $HOME/app # Install dependencies COPY --chown=user requirements.txt . RUN pip install --no-cache-dir --user -r requirements.txt # Copy application files COPY --chown=user . . # Expose port 7860 (Hugging Face default) and run EXPOSE 7860 CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]