Skip to content

Instantly share code, notes, and snippets.

@br4instormer
Last active October 22, 2024 12:28
Show Gist options
  • Save br4instormer/da6dd9e26e1bc249b2e5069215d592e9 to your computer and use it in GitHub Desktop.
Save br4instormer/da6dd9e26e1bc249b2e5069215d592e9 to your computer and use it in GitHub Desktop.
Docker image with yt-dlp within using ffmpeg 7 as muxer
FROM alpine:latest AS ffmpeg
WORKDIR /var/tmp
ADD https://github.com/yt-dlp/FFmpeg-Builds/releases/download/latest/ffmpeg-n7.1-latest-linux64-gpl-7.1.tar.xz .
RUN tar -xf ffmpeg-n7.1-latest-linux64-gpl-7.1.tar.xz
FROM python:3.13-slim-bookworm
ARG gid=100
ARG uid=1000
ARG catalog=/recordings
ARG home=/home/user
COPY --from=ffmpeg --chown=root /var/tmp/ffmpeg-n7.1-latest-linux64-gpl-7.1/bin/ffmpeg /usr/local/bin/
COPY --from=ffmpeg --chown=root /var/tmp/ffmpeg-n7.1-latest-linux64-gpl-7.1/bin/ffprobe /usr/local/bin/
RUN <<SCRIPT
getent group "$gid" > /dev/null \
|| groupadd -g "$gid" usergroup
useradd -u "$uid" -g "$gid" -s /bin/bash -m user
chsh -s /usr/sbin/nologin root
pip3 install --no-cache-dir "yt-dlp[default,curl-cffi]"
SCRIPT
USER user
RUN yt-dlp --version \
&& ffmpeg -version
WORKDIR $catalog
VOLUME $catalog
LABEL org.opencontainers.image.authors="br4instormer"
LABEL org.opencontainers.image.url="https://gist.github.com/br4instormer/da6dd9e26e1bc249b2e5069215d592e9"
LABEL org.opencontainers.image.licenses="MIT"
LABEL org.opencontainers.image.title="yt-dlp"
LABEL org.opencontainers.image.description="Docker image with yt-dlp within using ffmpeg 7 as muxer"
ENTRYPOINT [ "yt-dlp" ]
CMD [ "--help" ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment