# Build stage FROM python:3.11-slim WORKDIR /app # Install system dependencies (ffmpeg is critical for yt-dlp) RUN apt-get update && apt-get install -y --no-install-recommends \ ffmpeg \ curl \ && rm -rf /var/lib/apt/lists/* # Install Python dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy application code COPY . . # Environment variables ENV PYTHONUNBUFFERED=1 ENV FLASK_APP=wsgi.py ENV FLASK_ENV=production # Create directories for data persistence RUN mkdir -p /app/videos /app/data # Expose port EXPOSE 5000 # Run with Gunicorn CMD ["gunicorn", "--bind", "0.0.0.0:5000", "--workers", "4", "--threads", "2", "--timeout", "120", "wsgi:app"]