| |
| FROM python:3.10-slim |
|
|
| |
| ENV DEBIAN_FRONTEND=noninteractive |
| ENV PYTHONUNBUFFERED=1 |
| ENV PYTHONDONTWRITEBYTECODE=1 |
|
|
| |
| WORKDIR /app |
|
|
| |
| RUN apt-get update && apt-get install -y --no-install-recommends \ |
| build-essential \ |
| gcc \ |
| g++ \ |
| make \ |
| pkg-config \ |
| python3-dev \ |
| libffi-dev \ |
| libssl-dev \ |
| libcurl4-openssl-dev \ |
| ca-certificates \ |
| ffmpeg \ |
| git \ |
| git-lfs \ |
| curl \ |
| wget \ |
| cargo \ |
| rustc \ |
| && apt-get clean \ |
| && rm -rf /var/lib/apt/lists/* |
|
|
| |
| RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y |
| ENV PATH="/root/.cargo/bin:${PATH}" |
|
|
| |
| RUN pip install --no-cache-dir --upgrade pip setuptools wheel |
|
|
| |
| RUN pip install --no-cache-dir certifi requests brotli websockets |
|
|
| |
| RUN pip install --no-cache-dir curl-cffi |
|
|
| |
| RUN pip install --no-cache-dir "yt-dlp[default,curl-cffi]" |
|
|
| |
| RUN useradd -m -u 1000 user |
|
|
| |
| RUN mkdir -p /app/.cache /app/.config |
| RUN chown -R user:user /app |
|
|
| |
| ENV HF_HOME="/app/.cache" |
| ENV MPLCONFIGDIR="/app/.cache" |
|
|
| |
| USER user |
|
|
| |
| COPY --chown=user:user requirements.txt . |
| RUN pip install --no-cache-dir --user -r requirements.txt |
|
|
| |
| RUN mkdir -p ~/.config/yt-dlp |
| RUN echo "--user-agent 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'" > ~/.config/yt-dlp/config |
| RUN echo "--sleep-interval 3" >> ~/.config/yt-dlp/config |
| RUN echo "--geo-bypass" >> ~/.config/yt-dlp/config |
|
|
| |
| COPY --chown=user:user app.py . |
|
|
| |
| RUN echo '#!/bin/bash\necho "🚀 Starting App..."\necho "yt-dlp: $(yt-dlp --version)"\npython app.py' > start.sh && chmod +x start.sh |
|
|
| |
| EXPOSE 7860 |
|
|
| |
| HEALTHCHECK --interval=30s --timeout=10s --start-period=20s --retries=3 \ |
| CMD curl -f http://localhost:7860/ || exit 1 |
|
|
| |
| CMD ["./start.sh"] |