-
Notifications
You must be signed in to change notification settings - Fork 869
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docker: split up docker images for ffmpeg, gstreamer, and opencv
Signed-off-by: deadprogram <[email protected]>
- Loading branch information
1 parent
5a93cc9
commit 19c5a18
Showing
3 changed files
with
260 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
# syntax=docker/dockerfile:1.3 | ||
|
||
# To build release: | ||
# docker buildx build -f Dockerfile.ffmpeg-static-alpine -t ghcr.io/hybridgroup/ffmpeg:5.1.6-alpine --platform=linux/arm64,linux/amd64 --load . | ||
|
||
# Stage 1: Build OpenCV | ||
FROM --platform=linux/amd64 alpine:3.20 AS builder-amd64 | ||
|
||
# Install dependencies | ||
RUN apk update && apk add --no-cache \ | ||
build-base \ | ||
cmake \ | ||
git \ | ||
diffutils \ | ||
perl \ | ||
wget \ | ||
unzip \ | ||
pkgconfig \ | ||
libjpeg-turbo-dev \ | ||
libpng-dev \ | ||
libwebp-dev \ | ||
eigen-dev \ | ||
nasm yasm \ | ||
bzip2 xz zlib-dev x264-dev libvpx-dev \ | ||
opus-dev dav1d-dev python3 | ||
|
||
ARG FFMPEG_VERSION=5.1.6 | ||
ARG XZ_VERSION=5.6.3 | ||
|
||
# Build and install xz | ||
RUN wget -O xz-${XZ_VERSION}.tar.bz2 "https://github.com/tukaani-project/xz/releases/download/v${XZ_VERSION}/xz-${XZ_VERSION}.tar.bz2" && \ | ||
tar -xf xz-${XZ_VERSION}.tar.bz2 | ||
|
||
RUN cd xz-${XZ_VERSION} && \ | ||
./configure --disable-shared && \ | ||
make && make install | ||
|
||
# Build and install bzip2 | ||
RUN wget -O bzip2-master.tar.bz2 "https://gitlab.com/bzip2/bzip2/-/archive/master/bzip2-master.tar.bz2" && \ | ||
tar -xf bzip2-master.tar.bz2 | ||
|
||
RUN cd bzip2-master && \ | ||
mkdir build && cd build && \ | ||
cmake .. -DCMAKE_BUILD_TYPE="Release" -DENABLE_STATIC_LIB=ON -DENABLE_LIB_ONLY=ON && \ | ||
cmake --build . --target install | ||
|
||
# Build and install ffmpeg | ||
|
||
RUN wget -O ffmpeg-5.0.tar.bz2 "https://www.ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2" && \ | ||
tar -xf ffmpeg-5.0.tar.bz2 | ||
|
||
# Build and install libvpx | ||
RUN cd ffmpeg-${FFMPEG_VERSION} && \ | ||
git -C libvpx pull 2> /dev/null || git clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git && \ | ||
cd libvpx && \ | ||
./configure --enable-static --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm && \ | ||
make -j $(nproc --all) && make install | ||
|
||
# Now finish building ffmpeg | ||
RUN cd ffmpeg-${FFMPEG_VERSION} && \ | ||
./configure --pkg-config-flags="--static" \ | ||
--enable-static --disable-shared --enable-gpl --enable-libx264 --enable-libvpx --enable-zlib \ | ||
--disable-sdl2 --disable-vaapi --disable-vdpau --disable-v4l2-m2m --disable-doc && \ | ||
make -j $(nproc --all) && make install | ||
|
||
FROM --platform=linux/arm64 alpine:3.20 AS builder-arm64 | ||
|
||
# Install dependencies | ||
RUN apk update && apk add --no-cache \ | ||
build-base \ | ||
cmake \ | ||
git \ | ||
diffutils \ | ||
perl \ | ||
wget \ | ||
unzip \ | ||
pkgconfig \ | ||
libjpeg-turbo-dev \ | ||
libpng-dev \ | ||
libwebp-dev \ | ||
eigen-dev \ | ||
nasm yasm \ | ||
bzip2 xz zlib-dev x264-dev libvpx-dev \ | ||
opus-dev dav1d-dev python3 | ||
|
||
ARG FFMPEG_VERSION=5.1.6 | ||
ARG XZ_VERSION=5.6.3 | ||
|
||
# Build and install xz | ||
RUN wget -O xz-${XZ_VERSION}.tar.bz2 "https://github.com/tukaani-project/xz/releases/download/v${XZ_VERSION}/xz-${XZ_VERSION}.tar.bz2" && \ | ||
tar -xf xz-${XZ_VERSION}.tar.bz2 | ||
|
||
RUN cd xz-${XZ_VERSION} && \ | ||
./configure --disable-shared && \ | ||
make && make install | ||
|
||
# Build and install bzip2 | ||
RUN wget -O bzip2-master.tar.bz2 "https://gitlab.com/bzip2/bzip2/-/archive/master/bzip2-master.tar.bz2" && \ | ||
tar -xf bzip2-master.tar.bz2 | ||
|
||
RUN cd bzip2-master && \ | ||
mkdir build && cd build && \ | ||
cmake .. -DCMAKE_BUILD_TYPE="Release" -DENABLE_STATIC_LIB=ON -DENABLE_LIB_ONLY=ON && \ | ||
cmake --build . --target install | ||
|
||
# Build and install ffmpeg | ||
RUN wget -O ffmpeg-5.0.tar.bz2 "https://www.ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2" && \ | ||
tar -xf ffmpeg-5.0.tar.bz2 | ||
|
||
# Build and install libvpx | ||
RUN cd ffmpeg-${FFMPEG_VERSION} && \ | ||
git -C libvpx pull 2> /dev/null || git clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git && \ | ||
cd libvpx && \ | ||
./configure --enable-static --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm && \ | ||
make -j $(nproc --all) && make install | ||
|
||
# Now finish building ffmpeg | ||
RUN cd ffmpeg-${FFMPEG_VERSION} && \ | ||
./configure --pkg-config-flags="--static" \ | ||
--enable-static --disable-shared --enable-gpl --enable-libx264 --enable-libvpx --enable-zlib \ | ||
--disable-sdl2 --disable-vaapi --disable-vdpau --disable-v4l2-m2m --disable-doc && \ | ||
make -j $(nproc --all) && make install | ||
|
||
# Stage 2: Create final image | ||
FROM builder-${TARGETARCH} AS final | ||
|
||
CMD ["ffmpeg"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
# To build release: | ||
# docker buildx build -f Dockerfile.gstreamer-static-alpine -t ghcr.io/hybridgroup/gstreamer:1.24-alpine --platform=linux/arm64,linux/amd64 --load . | ||
|
||
FROM --platform=linux/amd64 alpine:3.20 AS builder-amd64 | ||
|
||
WORKDIR /gstreamer | ||
|
||
ARG GST_BUILD_VERSION=1.24 | ||
RUN wget https://gitlab.freedesktop.org/gstreamer/gstreamer/-/archive/${GST_BUILD_VERSION}/gstreamer-${GST_BUILD_VERSION}.tar.gz && \ | ||
tar -xvzf gstreamer-${GST_BUILD_VERSION}.tar.gz | ||
|
||
WORKDIR /gstreamer/gstreamer-${GST_BUILD_VERSION} | ||
|
||
RUN apk update && apk add build-base \ | ||
libxml2-dev \ | ||
bison \ | ||
flex \ | ||
glib-dev \ | ||
gobject-introspection-dev \ | ||
libcap-dev \ | ||
libcap-utils \ | ||
meson \ | ||
perl \ | ||
wget \ | ||
git \ | ||
nasm | ||
|
||
RUN meson --default-library=static --prefix=/gstbin \ | ||
-Dgst-full-target-type=static_library \ | ||
-Dauto_features=disabled \ | ||
-Dbase=enabled \ | ||
-Dgood=enabled \ | ||
-Dbad=enabled \ | ||
-Dgst-plugins-base:typefind=enabled \ | ||
-Dgst-plugins-base:playback=enabled \ | ||
-Dgst-plugins-base:volume=enabled \ | ||
-Dgst-plugins-base:audioconvert=enabled \ | ||
-Dgst-plugins-base:app=enabled \ | ||
-Dgst-plugins-good:isomp4=enabled \ | ||
-Dgst-plugins-good:rtp=enabled \ | ||
-Dgst-plugins-good:udp=enabled \ | ||
-Dgst-plugins-good:rtsp=enabled \ | ||
-Dgst-plugins-good:rtpmanager=enabled \ | ||
-Dgst-plugins-good:audioparsers=enabled \ | ||
-Dgst-plugins-bad:videoparsers=enabled \ | ||
-Dgst-plugins-bad:codectimestamper=enabled \ | ||
-Dgst-plugins-bad:openh264=enabled \ | ||
-Dtools=disabled \ | ||
build | ||
|
||
RUN meson compile -C build | ||
|
||
RUN meson install -C build | ||
|
||
|
||
FROM --platform=linux/arm64 alpine:3.20 AS builder-arm64 | ||
|
||
WORKDIR /gstreamer | ||
|
||
ARG GST_BUILD_VERSION=1.24 | ||
RUN wget https://gitlab.freedesktop.org/gstreamer/gstreamer/-/archive/${GST_BUILD_VERSION}/gstreamer-${GST_BUILD_VERSION}.tar.gz && \ | ||
tar -xvzf gstreamer-${GST_BUILD_VERSION}.tar.gz | ||
|
||
WORKDIR /gstreamer/gstreamer-${GST_BUILD_VERSION} | ||
|
||
RUN apk update && apk add build-base \ | ||
libxml2-dev \ | ||
bison \ | ||
flex \ | ||
glib-dev \ | ||
gobject-introspection-dev \ | ||
libcap-dev \ | ||
libcap-utils \ | ||
meson \ | ||
perl \ | ||
wget \ | ||
git \ | ||
nasm | ||
|
||
RUN meson --default-library=static --prefix=/gstbin \ | ||
-Dgst-full-target-type=static_library \ | ||
-Dauto_features=disabled \ | ||
-Dbase=enabled \ | ||
-Dgood=enabled \ | ||
-Dbad=enabled \ | ||
-Dgst-plugins-base:typefind=enabled \ | ||
-Dgst-plugins-base:playback=enabled \ | ||
-Dgst-plugins-base:volume=enabled \ | ||
-Dgst-plugins-base:audioconvert=enabled \ | ||
-Dgst-plugins-base:app=enabled \ | ||
-Dgst-plugins-good:isomp4=enabled \ | ||
-Dgst-plugins-good:rtp=enabled \ | ||
-Dgst-plugins-good:udp=enabled \ | ||
-Dgst-plugins-good:rtsp=enabled \ | ||
-Dgst-plugins-good:rtpmanager=enabled \ | ||
-Dgst-plugins-good:audioparsers=enabled \ | ||
-Dgst-plugins-bad:videoparsers=enabled \ | ||
-Dgst-plugins-bad:codectimestamper=enabled \ | ||
-Dgst-plugins-bad:openh264=enabled \ | ||
-Dtools=disabled \ | ||
build | ||
|
||
RUN meson compile -C build | ||
|
||
RUN meson install -C build | ||
|
||
ARG TARGETARCH | ||
|
||
FROM builder-${TARGETARCH} AS final | ||
|
||
ENV PATH=/gstbin/bin:${PATH} | ||
ENV LD_LIBRARY_PATH=/usr/lib:/gstbin/lib:/usr/local/lib:${LD_LIBRARY_PATH} | ||
Check warning on line 112 in Dockerfile.gstreamer-static-alpine GitHub Actions / gstreamerVariables should be defined before their use
|
||
ENV PKG_CONFIG_PATH=/gstbin/lib/pkgconfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters