FROM python:3.11-slim # Create a non-root user (required by Hugging Face Spaces) RUN useradd -m -u 1000 user USER user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH WORKDIR $HOME/app # Copy requirements and install COPY --chown=user requirements.txt . RUN pip install --no-cache-dir --upgrade pip && \ pip install --no-cache-dir -r requirements.txt # Copy the rest of the application files COPY --chown=user . . # Set environment variables required for Hugging Face Spaces ENV PORT=7860 EXPOSE 7860 # Command to run the application CMD ["python", "app.py"]