use TARGETPLATFORM to install repo ffmpeg for arm64 and patched ffmpeg for amd64 builds

This commit is contained in:
simon 2021-10-12 23:00:25 +07:00
parent a4ae6ca1ca
commit 3473c79d63

View File

@ -1,6 +1,7 @@
# build the tube archivist image from default python slim image # build the tube archivist image from default python slim image
FROM python:3.9.7-slim-bullseye FROM python:3.9.7-slim-bullseye
ARG TARGETPLATFORM
ENV PYTHONUNBUFFERED 1 ENV PYTHONUNBUFFERED 1
@ -10,15 +11,19 @@ RUN apt-get clean && apt-get -y update && apt-get -y install --no-install-recomm
nginx \ nginx \
curl && rm -rf /var/lib/apt/lists/* curl && rm -rf /var/lib/apt/lists/*
# get newest patched ffmpeg and ffprobe builds # get newest patched ffmpeg and ffprobe builds for amd64 fall back to repo ffmpeg for arm64
RUN curl -s https://api.github.com/repos/yt-dlp/FFmpeg-Builds/releases/latest \ RUN if [ "$TARGETPLATFORM" = "linux/amd64" ] ; then \
| grep browser_download_url \ curl -s https://api.github.com/repos/yt-dlp/FFmpeg-Builds/releases/latest \
| grep linux64-nonfree.tar.xz \ | grep browser_download_url \
| cut -d '"' -f 4 \ | grep linux64-gpl-4.4.tar.xz \
| xargs curl -L --output ffmpeg.tar.xz && \ | cut -d '"' -f 4 \
tar -xf ffmpeg.tar.xz --strip-components=2 --no-anchored -C /usr/bin/ "ffmpeg" && \ | xargs curl -L --output ffmpeg.tar.xz && \
tar -xf ffmpeg.tar.xz --strip-components=2 --no-anchored -C /usr/bin/ "ffprobe" && \ tar -xf ffmpeg.tar.xz --strip-components=2 --no-anchored -C /usr/bin/ "ffmpeg" && \
rm ffmpeg.tar.xz tar -xf ffmpeg.tar.xz --strip-components=2 --no-anchored -C /usr/bin/ "ffprobe" && \
rm ffmpeg.tar.xz \
; elif [ "$TARGETPLATFORM" = "linux/arm64" ] ; then \
apt-get -y update && apt-get -y install --no-install-recommends ffmpeg && rm -rf /var/lib/apt/lists/* \
; fi
# copy config files # copy config files
COPY nginx.conf /etc/nginx/conf.d/ COPY nginx.conf /etc/nginx/conf.d/