FROM python:3.12-slim # Install ffmpeg (required for merging video+audio streams and MP3 conversion) RUN apt-get update && \ apt-get install -y --no-install-recommends ffmpeg && \ rm -rf /var/lib/apt/lists/* WORKDIR /app # Install Python dependencies COPY app/requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy application code and static files COPY app/ . # Downloads are stored here (mount a host volume to persist them) RUN mkdir -p /downloads # Setup Cronjob RUN apt-get update && apt-get install -y cron && \ echo "0 4 * * * pip install --upgrade yt-dlp >> /var/log/yt-dlp-upgrade.log 2>&1" | crontab - EXPOSE 8080 CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8080"]