FROM python:3.11-slim # Install OS updates & basic system packages RUN apt-get update -y && apt-get upgrade -y \ && apt-get install -y --no-install-recommends ffmpeg git \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* # Set up user to run the application (Hugging Face Space requirement) RUN useradd -m -u 1000 user USER user ENV PATH="/home/user/.local/bin:$PATH" WORKDIR /app # Pre-install dependencies at build time to make startup fast and avoid user permissions issues COPY --chown=user requirements.txt requirements.txt RUN pip install --no-cache-dir --upgrade -r requirements.txt # Copy application files COPY --chown=user . /app ENV PORT=7860 CMD ["python", "-u", "main.py"]