feat: use apt for installing ffmpeg

This commit is contained in:
Markos Gogoulos 2025-07-07 13:00:33 +03:00
parent df98b65704
commit 8aa89c0958

View File

@ -2,17 +2,18 @@ FROM python:3.13.5-bookworm AS build-image
# Install system dependencies needed for downloading and extracting # Install system dependencies needed for downloading and extracting
RUN apt-get update -y && \ RUN apt-get update -y && \
apt-get install -y --no-install-recommends wget xz-utils unzip && \ apt-get install -y --no-install-recommends wget xz-utils unzip ffmpeg && \
rm -rf /var/lib/apt/lists/* && \ rm -rf /var/lib/apt/lists/* && \
apt-get purge --auto-remove && \ apt-get purge --auto-remove && \
apt-get clean apt-get clean
# Install ffmpeg # Install ffmpeg - using apt package instead of static binary for faster builds
RUN wget -q https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz && \ # Original static binary download hangs in github actions:
mkdir -p ffmpeg-tmp && \ # RUN wget -q https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz && \
tar -xf ffmpeg-release-amd64-static.tar.xz --strip-components 1 -C ffmpeg-tmp && \ # mkdir -p ffmpeg-tmp && \
cp -v ffmpeg-tmp/ffmpeg ffmpeg-tmp/ffprobe ffmpeg-tmp/qt-faststart /usr/local/bin && \ # tar -xf ffmpeg-release-amd64-static.tar.xz --strip-components 1 -C ffmpeg-tmp && \
rm -rf ffmpeg-tmp ffmpeg-release-amd64-static.tar.xz # cp -v ffmpeg-tmp/ffmpeg ffmpeg-tmp/ffprobe ffmpeg-tmp/qt-faststart /usr/local/bin && \
# rm -rf ffmpeg-tmp ffmpeg-release-amd64-static.tar.xz
# Install Bento4 in the specified location # Install Bento4 in the specified location
RUN mkdir -p /home/mediacms.io/bento4 && \ RUN mkdir -p /home/mediacms.io/bento4 && \
@ -34,18 +35,19 @@ ENV CELERY_APP='cms'
ENV VIRTUAL_ENV=/home/mediacms.io ENV VIRTUAL_ENV=/home/mediacms.io
ENV PATH="$VIRTUAL_ENV/bin:$PATH" ENV PATH="$VIRTUAL_ENV/bin:$PATH"
# Install runtime system dependencies # Install runtime system dependencies (including ffmpeg)
RUN apt-get update -y && \ RUN apt-get update -y && \
apt-get -y upgrade && \ apt-get -y upgrade && \
apt-get install --no-install-recommends supervisor nginx imagemagick procps pkg-config libxml2-dev libxmlsec1-dev libxmlsec1-openssl -y && \ apt-get install --no-install-recommends supervisor nginx imagemagick procps pkg-config libxml2-dev libxmlsec1-dev libxmlsec1-openssl ffmpeg -y && \
rm -rf /var/lib/apt/lists/* && \ rm -rf /var/lib/apt/lists/* && \
apt-get purge --auto-remove && \ apt-get purge --auto-remove && \
apt-get clean apt-get clean
# Copy ffmpeg and Bento4 from build image # Copy Bento4 from build image (ffmpeg now available system-wide via apt)
COPY --from=build-image /usr/local/bin/ffmpeg /usr/local/bin/ffmpeg # Original binary copying (no longer needed):
COPY --from=build-image /usr/local/bin/ffprobe /usr/local/bin/ffprobe # COPY --from=build-image /usr/local/bin/ffmpeg /usr/local/bin/ffmpeg
COPY --from=build-image /usr/local/bin/qt-faststart /usr/local/bin/qt-faststart # COPY --from=build-image /usr/local/bin/ffprobe /usr/local/bin/ffprobe
# COPY --from=build-image /usr/local/bin/qt-faststart /usr/local/bin/qt-faststart
COPY --from=build-image /home/mediacms.io/bento4 /home/mediacms.io/bento4 COPY --from=build-image /home/mediacms.io/bento4 /home/mediacms.io/bento4
# Set up virtualenv # Set up virtualenv
@ -69,7 +71,6 @@ COPY . /home/mediacms.io/mediacms
WORKDIR /home/mediacms.io/mediacms WORKDIR /home/mediacms.io/mediacms
# required for sprite thumbnail generation for large video files # required for sprite thumbnail generation for large video files
COPY deploy/docker/policy.xml /etc/ImageMagick-6/policy.xml COPY deploy/docker/policy.xml /etc/ImageMagick-6/policy.xml
# Set process control environment variables # Set process control environment variables