# Use high-performance Python slim image FROM python:3.11-slim # Set up a new user named "user" with user ID 1000 # Hugging Face Spaces requires a non-root user with UID 1000 RUN useradd -m -u 1000 user USER user ENV PATH="/home/user/.local/bin:$PATH" # Set working directory WORKDIR /app # Copy and install dependencies first for better caching COPY --chown=user requirements.txt . RUN pip install --no-cache-dir --upgrade -r requirements.txt # Copy current project files with correct ownership COPY --chown=user . . # Hugging Face Spaces default port EXPOSE 7860 # Command to run the application CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]