# Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker # you will also find guides on how best to write your Dockerfile FROM python:3.10-slim # Install system dependencies BEFORE switching to user RUN apt-get update && apt-get install -y \ ffmpeg \ && rm -rf /var/lib/apt/lists/* # Install build tools as root RUN pip install --no-cache-dir --upgrade pip setuptools wheel setuptools-scm # Copy and install requirements BEFORE switching user COPY ./requirements.txt /tmp/requirements.txt RUN pip install --no-cache-dir -r /tmp/requirements.txt RUN useradd -m -u 1000 user USER user ENV PATH="/home/user/.local/bin:$PATH" WORKDIR /app COPY --chown=user . /app # Flask app runs on port 7860 for HF Spaces CMD ["python", "app.py"]