FROM python:3.11-slim # Set working directory WORKDIR /app # Install system dependencies (required for yt-dlp and ffmpeg) RUN apt-get update && apt-get install -y \ ffmpeg \ && rm -rf /var/lib/apt/lists/* # Copy requirements first for better caching COPY requirements.txt . # Install Python dependencies RUN pip install --no-cache-dir -r requirements.txt # Copy application code COPY app.py . # Create directory for cookies RUN mkdir -p /app/cookies # Expose port EXPOSE 7860 # Environment variables ENV COOKIES_DIR=/app/cookies ENV PORT=7860 ENV PYTHONUNBUFFERED=1 # Run with gunicorn for production # CMD ["gunicorn", "--bind", "0.0.0.0:8000", "--workers", "4", "--timeout", "120", "app:app"] CMD ["python", "app.py"]