FROM python:3.10 # Set up a non-root user for Hugging Face Spaces RUN useradd -m -u 1000 user USER user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH WORKDIR $HOME/app # Install dependencies COPY --chown=user requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy application files COPY --chown=user . . # Expose the correct port EXPOSE 7860 # Command to run the FastAPI app via Uvicorn CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]