feature: Alpine static improved (#1243)

* build: add workflow to build static docker images based on Alpine
* docker: Docker image with OpenCV targeting alpine that is fully static
* docker: split up docker images for ffmpeg, gstreamer, and opencv

---------

Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
Ron Evans
2024-10-19 16:25:32 +01:00
committed by GitHub
parent 6935b87203
commit ca737476d7
5 changed files with 689 additions and 0 deletions

View File

@@ -0,0 +1,156 @@
# This is the Github action to build and push the gocv/opencv Docker images.
#
name: Docker
on:
push:
branches: [build-opencv-alpine, alpine-static-improved]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
gstreamer:
name: gstreamer
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Check out the repo
uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
gocv/gstreamer:1.24-alpine
ghcr.io/${{ github.repository_owner }}/gstreamer:1.24-alpine
tags: |
type=sha,format=long
type=raw,value=latest
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Log in to Github Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
file: Dockerfile.gstreamer-static-alpine
platforms: linux/amd64,linux/arm64
context: .
push: true
tags: |
gocv/gstreamer:1.24-alpine
ghcr.io/${{ github.repository_owner }}/gstreamer:1.24-alpine
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
ffmpeg:
name: ffmpeg
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Check out the repo
uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
gocv/ffmpeg:5.16-alpine
ghcr.io/${{ github.repository_owner }}/ffmpeg:5.16-alpine
tags: |
type=sha,format=long
type=raw,value=latest
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Log in to Github Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
file: Dockerfile.ffmpeg-static-alpine
platforms: linux/amd64,linux/arm64
context: .
push: true
tags: |
gocv/ffmpeg:5.16-alpine
ghcr.io/${{ github.repository_owner }}/ffmpeg:5.16-alpine
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
opencv:
name: opencv
runs-on: ubuntu-latest
needs: [gstreamer, ffmpeg]
permissions:
packages: write
contents: read
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Check out the repo
uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
gocv/opencv:4.10.0-alpine
ghcr.io/${{ github.repository_owner }}/opencv:4.10.0-alpine
tags: |
type=sha,format=long
type=raw,value=latest
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Log in to Github Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
file: Dockerfile.opencv-static-alpine
platforms: linux/amd64,linux/arm64
context: .
push: true
tags: |
gocv/opencv:4.10.0-alpine
ghcr.io/${{ github.repository_owner }}/opencv:4.10.0-alpine
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

91
.github/workflows/docker-alpine.yml vendored Normal file
View File

@@ -0,0 +1,91 @@
# This is the Github action to build and push the gocv/opencv Docker images.
#
name: Docker
on:
push:
branches: [build-opencv-alpine, alpine-static]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
opencv-static:
name: opencv-static
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Check disk space
run: df . -h
- name: Free disk space
run: |
sudo docker rmi $(docker image ls -aq) >/dev/null 2>&1 || true
sudo rm -rf \
/usr/share/dotnet /usr/local/lib/android /opt/ghc \
/usr/local/share/powershell /usr/share/swift /usr/local/.ghcup \
/usr/lib/jvm || true
echo "extra directories deleted"
sudo apt install aptitude -y >/dev/null 2>&1
sudo aptitude purge aria2 ansible azure-cli shellcheck rpm xorriso zsync \
esl-erlang firefox gfortran-8 gfortran-9 google-chrome-stable \
google-cloud-sdk imagemagick \
libmagickcore-dev libmagickwand-dev libmagic-dev ant ant-optional kubectl \
mercurial apt-transport-https mono-complete libmysqlclient \
unixodbc-dev yarn chrpath libssl-dev libxft-dev \
libfreetype6 libfreetype6-dev libfontconfig1 libfontconfig1-dev \
snmp pollinate libpq-dev postgresql-client powershell ruby-full \
sphinxsearch subversion mongodb-org azure-cli microsoft-edge-stable \
-y -f >/dev/null 2>&1
sudo aptitude purge google-cloud-sdk -f -y >/dev/null 2>&1
sudo aptitude purge microsoft-edge-stable -f -y >/dev/null 2>&1 || true
sudo apt purge microsoft-edge-stable -f -y >/dev/null 2>&1 || true
sudo aptitude purge '~n ^mysql' -f -y >/dev/null 2>&1
sudo aptitude purge '~n ^php' -f -y >/dev/null 2>&1
sudo aptitude purge '~n ^dotnet' -f -y >/dev/null 2>&1
sudo apt-get autoremove -y >/dev/null 2>&1
sudo apt-get autoclean -y >/dev/null 2>&1
echo "extra packages purged"
- name: Check disk space
run: df . -h
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Check out the repo
uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
gocv/opencv:4.10.0-alpine
ghcr.io/${{ github.repository_owner }}/opencv:4.10.0-alpine
tags: |
type=sha,format=long
type=raw,value=latest
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Log in to Github Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
file: Dockerfile.opencv-static-alpine
platforms: linux/amd64,linux/arm64
context: .
push: true
tags: |
gocv/opencv:4.10.0-alpine
ghcr.io/${{ github.repository_owner }}/opencv:4.10.0-alpine
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

View File

@@ -0,0 +1,136 @@
# syntax=docker/dockerfile:1.3
# To build release:
# docker buildx build -f Dockerfile.ffmpeg-static-alpine -t ghcr.io/hybridgroup/ffmpeg:5.16-alpine --platform=linux/arm64,linux/amd64 --load .
# linux/amd64 build
FROM --platform=linux/amd64 alpine:3.20 AS builder-amd64
WORKDIR /
ARG FFMPEG_VERSION=5.1.6
ARG XZ_VERSION=5.6.3
# download 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
# download 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
# download ffmpeg source
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
# 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
# Build and install xz
RUN cd xz-${XZ_VERSION} && \
./configure --disable-shared && \
make && make install
# Build and install bzip2
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 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
# linux/arm64 build
FROM --platform=linux/arm64 alpine:3.20 AS builder-arm64
WORKDIR /
ARG FFMPEG_VERSION=5.1.6
ARG XZ_VERSION=5.6.3
# download 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
# download 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
# download ffmpeg source
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
# 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
# Build and install xz
RUN cd xz-${XZ_VERSION} && \
./configure --disable-shared && \
make && make install
# Build and install bzip2
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 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"]

View File

@@ -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 -xzf 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 -xzf 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}
ENV PKG_CONFIG_PATH=/gstbin/lib/pkgconfig

View File

@@ -0,0 +1,193 @@
# syntax=docker/dockerfile:1.3
# To build release:
# docker buildx build -f Dockerfile.opencv-static-alpine -t ghcr.io/hybridgroup/opencv:4.10-alpine --platform=linux/arm64,linux/amd64 --load .
# linux/amd64 build
FROM --platform=linux/amd64 ghcr.io/hybridgroup/gstreamer:1.24-alpine AS gstreamer-amd64
# Stage 1: Build OpenCV
FROM --platform=linux/amd64 ghcr.io/hybridgroup/ffmpeg:5.16-alpine AS builder-amd64
# Set OpenCV version
ARG OPENCV_VERSION=4.10.0
# Download OpenCV source code
WORKDIR /opencv
RUN wget -O opencv.zip https://github.com/opencv/opencv/archive/${OPENCV_VERSION}.zip && \
unzip -q opencv.zip && \
mv opencv-${OPENCV_VERSION} opencv
WORKDIR /opencv_contrib
RUN wget -O opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/${OPENCV_VERSION}.zip && \
unzip -q opencv_contrib.zip && \
mv opencv_contrib-${OPENCV_VERSION} opencv_contrib
# 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 openssl \
libxml2-dev \
bison \
flex \
glib-dev \
gobject-introspection-dev \
libcap-dev \
libcap-utils \
meson
# copy gstreamer
COPY --from=gstreamer-amd64 /gstbin/lib /usr/local/lib
COPY --from=gstreamer-amd64 /gstbin/include/gstreamer-1.0/gst /usr/local/include/gst
# Build OpenCV
WORKDIR /opencv/opencv/build
RUN cmake -D CMAKE_BUILD_TYPE=Release \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D WITH_IPP=ON \
-D BUILD_WITH_DYNAMIC_IPP=OFF \
-D BUILD_IPP_IW=ON \
-D WITH_OPENGL=ON \
-D BUILD_OPENGL=ON \
-D WITH_QT=OFF \
-D WITH_FREETYPE=OFF \
-D OPENCV_EXTRA_MODULES_PATH=/opencv_contrib/opencv_contrib/modules \
-D OPENCV_ENABLE_NONFREE=ON \
-D BUILD_SHARED_LIBS=OFF \
-D WITH_FFMPEG=ON \
-D WITH_GSTREAMER=ON \
-D WITH_TBB=ON \
-D WITH_SIMD=ON \
-D BUILD_EXAMPLES=OFF \
-D BUILD_TESTS=OFF \
-D BUILD_PERF_TESTS=OFF \
-D OPENCV_GENERATE_PKGCONFIG=ON \
-D WITH_WEBP=ON \
-D BUILD_WEBP=ON \
-D WITH_OPENJPEG=ON \
-D BUILD_OPENJPEG=ON \
-D BUILD_TIFF=ON \
-D BUILD_PNG=ON \
-D BUILD_ZLIB=ON \
-D BUILD_JPEG=ON \
-D WITH_SIMD=ON \
-D ENABLE_LIBJPEG_TURBO_SIMD=OFF \
-D BUILD_opencv_java=NO \
-D BUILD_opencv_python=NO \
-D BUILD_opencv_python2=NO \
-D BUILD_opencv_python3=NO \
.. && \
make -j$(nproc) && \
make install
# linux/arm64 build
FROM --platform=linux/arm64 ghcr.io/hybridgroup/gstreamer:1.24-alpine AS gstreamer-arm64
FROM --platform=linux/arm64 ghcr.io/hybridgroup/ffmpeg:5.16-alpine AS builder-arm64
# Set OpenCV version
ARG OPENCV_VERSION=4.10.0
# Download OpenCV source code
WORKDIR /opencv
RUN wget -O opencv.zip https://github.com/opencv/opencv/archive/${OPENCV_VERSION}.zip && \
unzip -q opencv.zip && \
mv opencv-${OPENCV_VERSION} opencv
WORKDIR /opencv_contrib
RUN wget -O opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/${OPENCV_VERSION}.zip && \
unzip -q opencv_contrib.zip && \
mv opencv_contrib-${OPENCV_VERSION} opencv_contrib
# 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 openssl \
libxml2-dev \
bison \
flex \
glib-dev \
gobject-introspection-dev \
libcap-dev \
libcap-utils \
meson
# copy gstreamer
COPY --from=gstreamer-arm64 /gstbin/lib /usr/local/lib
COPY --from=gstreamer-arm64 /gstbin/include/gstreamer-1.0/gst /usr/local/include/gst
# Build OpenCV
WORKDIR /opencv/opencv/build
RUN cmake -D CMAKE_BUILD_TYPE=Release \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D WITH_IPP=OFF \
-D ENABLE_NEON=ON \
-D WITH_OPENGL=ON \
-D BUILD_OPENGL=ON \
-D WITH_QT=OFF \
-D WITH_FREETYPE=OFF \
-D OPENCV_EXTRA_MODULES_PATH=/opencv_contrib/opencv_contrib/modules \
-D OPENCV_ENABLE_NONFREE=ON \
-D BUILD_SHARED_LIBS=OFF \
-D WITH_FFMPEG=ON \
-D WITH_GSTREAMER=ON \
-D WITH_TBB=ON \
-D WITH_SIMD=ON \
-D ENABLE_LIBJPEG_TURBO_SIMD=OFF \
-D BUILD_EXAMPLES=OFF \
-D BUILD_TESTS=OFF \
-D BUILD_PERF_TESTS=OFF \
-D OPENCV_GENERATE_PKGCONFIG=ON \
-D WITH_WEBP=ON \
-D BUILD_WEBP=ON \
-D WITH_OPENJPEG=ON \
-D BUILD_OPENJPEG=ON \
-D BUILD_TIFF=ON \
-D BUILD_PNG=ON \
-D BUILD_ZLIB=ON \
-D BUILD_JPEG=ON \
-D WITH_SIMD=ON \
-D ENABLE_LIBJPEG_TURBO_SIMD=OFF \
-D BUILD_opencv_java=NO \
-D BUILD_opencv_python=NO \
-D BUILD_opencv_python2=NO \
-D BUILD_opencv_python3=NO \
.. && \
make -j$(nproc) && \
make install
# Stage 2: Create final image
FROM builder-${TARGETARCH} AS final
# Set environment variables
ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib/opencv4/3rdparty:${LD_LIBRARY_PATH}
CMD ["opencv_version", "-b"]