FROM python:3.10-slim # Set the working directory WORKDIR /app # Install system dependencies (useful for building some python packages) RUN apt-get update && apt-get install -y \ build-essential \ && rm -rf /var/lib/apt/lists/* # Copy requirements first to leverage Docker cache COPY requirements.txt . # Install Python dependencies # Hugging Face Spaces installs to ~/.cache, so we configure pip to not complain about running as root RUN pip install --no-cache-dir -r requirements.txt # Copy the rest of the application COPY . . # Expose port 7860 for Hugging Face Spaces EXPOSE 7860 # Run the Hugging Face specific runner script CMD ["python", "run_hf.py"]