FROM python:3.10-slim # System dependencies for FFmpeg, OpenCV, MediaPipe, DNS debugging RUN apt-get update && apt-get install -y --no-install-recommends \ ffmpeg \ libgl1 \ libglib2.0-0 \ libsm6 \ libxext6 \ libxrender1 \ git \ dnsutils \ curl \ python3-dev \ python3-pip \ nodejs \ npm \ && rm -rf /var/lib/apt/lists/* # Create non-root user (HF Spaces requirement) RUN useradd -m -u 1000 user USER user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH WORKDIR /home/user/app # Install Python dependencies COPY --chown=user requirements.txt . RUN pip install --no-cache-dir --upgrade pip setuptools wheel && \ pip install --no-cache-dir --no-build-isolation openai-whisper==20240930 && \ pip install --no-cache-dir -r requirements.txt && \ pip install --no-cache-dir -U yt-dlp # Copy application files COPY --chown=user . . # Create writable directories for clips and downloads RUN mkdir -p clips downloads # Create empty cookies.txt if not provided (user can upload their own) RUN test -f cookies.txt || touch cookies.txt # HF Spaces expects port 7860 ENV PORT=7860 EXPOSE 7860 CMD ["python", "server.py"]