FROM ubuntu:noble AS builder
ARG FFMPEG_VERSION="8.1"
ARG RCLONE_VER="latest"
ARG GO_VERSION="latest"
USER root
ARG TOOLS_DEPS="autoconf automake cmake libfreetype6 gcc build-essential libtool make nasm pkg-config zlib1g-dev numactl \
libnuma-dev yasm git curl jq wget ca-certificates \
libx11-dev libxcb1-dev libpulse-dev libasound2-dev"
RUN apt-get update -qqy \
&& apt-get upgrade -yq \
&& apt-get -qqy --no-install-recommends install ${TOOLS_DEPS} \
&& apt-get -qyy clean \
&& mkdir -p /usr/local/src
RUN if [ "${GO_VERSION}" = "latest" ]; then \
GO_VERSION=$(curl -sk https://go.dev/dl/?mode=json | jq -r '.[0].version'); \
fi \
&& curl -skLO https://go.dev/dl/${GO_VERSION}.linux-$(dpkg --print-architecture).tar.gz \
&& tar -xf ${GO_VERSION}.linux-$(dpkg --print-architecture).tar.gz -C /usr/local \
&& rm -rf ${GO_VERSION}.linux-$(dpkg --print-architecture).tar.gz* \
&& ln -sf /usr/local/go/bin/go /usr/bin/go \
&& go version
RUN cd /usr/local/src \
&& if [ "${RCLONE_VER}" = "latest" ]; then \
RCLONE_VER=$(curl -sk https://api.github.com/repos/rclone/rclone/releases/latest | jq -r '.tag_name // empty'); \
if [ -z "${RCLONE_VER}" ]; then \
RCLONE_VER=$(git ls-remote --tags --refs https://github.com/rclone/rclone.git \
| sed 's#.*refs/tags/##' | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -n 1); \
fi; \
fi \
&& echo "Building rclone ${RCLONE_VER}" \
&& git clone -b ${RCLONE_VER} --single-branch --depth 1 https://github.com/rclone/rclone.git \
&& cd rclone \
&& make \
&& mv ~/go/bin/rclone /usr/local/bin/ \
&& rclone version
RUN cd /usr/local/src \
&& git clone https://code.videolan.org/videolan/x264.git --filter=blob:none \
&& cd x264 \
&& ./configure --prefix="/usr/local" --enable-static \
&& make \
&& make install
RUN cd /usr/local/src \
&& git clone -b release/${FFMPEG_VERSION} --single-branch --depth 1 https://github.com/FFmpeg/FFmpeg.git \
&& cd FFmpeg \
&& rm -rf .git \
&& PKG_CONFIG_PATH="/usr/local/lib/pkgconfig" FFMPEG_VERSION=${FFMPEG_VERSION} ./configure \
--prefix="/usr/local" \
--extra-cflags="-I/usr/local/include" \
--extra-ldflags="-L/usr/local/lib" \
--pkg-config-flags="--static" \
--enable-gpl \
--enable-nonfree \
--enable-libx264 \
--enable-libxcb \
--enable-libpulse \
--enable-alsa \
--enable-static \
&& make \
&& make install
FROM ubuntu:noble
USER root
COPY --from=builder /usr/local/bin/ffmpeg /usr/local/bin/ffmpeg
COPY --from=builder /usr/local/bin/rclone /usr/local/bin/rclone
RUN apt-get -qqy update \
&& apt-get -qqy --no-install-recommends install \
libx11-6 libx11-xcb1 libxcb1 libpulse0 libasound2t64 \
&& apt-get -qqy update \
&& apt-get -yq upgrade \
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*
RUN ldd /usr/local/bin/ffmpeg \
&& ffmpeg -version \
&& rclone --version
USER 101