|
| 1 | +# Version: 20250630 |
| 2 | +# Image name: quay.io/opencv-ci/opencv-python-manylinux2014-x86-64 |
| 3 | + |
| 4 | +FROM quay.io/pypa/manylinux_2_28_x86_64:latest |
| 5 | + |
| 6 | +ARG FFMPEG_VERSION=5.1.6 |
| 7 | +ARG FREETYPE_VERSION=2.13.3 |
| 8 | +ARG LIBPNG_VERSION=1.6.48 |
| 9 | +ARG VPX_VERSION=v1.15.1 |
| 10 | +ARG QT_VERSION=5.15.16 |
| 11 | +ARG AOM_VERSION=v3.12.1 |
| 12 | +ARG AVIF_VERSION=v1.3.0 |
| 13 | + |
| 14 | +ENV LD_LIBRARY_PATH /usr/local/lib:$LD_LIBRARY_PATH |
| 15 | + |
| 16 | +# epel-release need for aarch64 to get openblas packages |
| 17 | +RUN yum install zlib-devel curl-devel xcb-util-renderutil-devel xcb-util-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-wm-devel mesa-libGL-devel libxkbcommon-devel libxkbcommon-x11-devel libXi-devel lapack-devel epel-release -y && \ |
| 18 | + yum install openblas-devel dejavu-sans-fonts ccache yasm nasm ninja-build openssl openssl-devel -y && \ |
| 19 | + # libpng will be built from source |
| 20 | + yum remove libpng -y |
| 21 | + |
| 22 | +RUN mkdir ~/libpng_sources && \ |
| 23 | + cd ~/libpng_sources && \ |
| 24 | + curl -O -L https://download.sourceforge.net/libpng/libpng-${LIBPNG_VERSION}.tar.gz && \ |
| 25 | + tar -xf libpng-${LIBPNG_VERSION}.tar.gz && \ |
| 26 | + cd libpng-${LIBPNG_VERSION} && \ |
| 27 | + ./configure --prefix=/usr/local && \ |
| 28 | + make && \ |
| 29 | + make install && \ |
| 30 | + cd .. && \ |
| 31 | + rm -rf ~/libpng_sources |
| 32 | + |
| 33 | +RUN mkdir ~/freetype_sources && \ |
| 34 | + cd ~/freetype_sources && \ |
| 35 | + curl -O -L https://download.savannah.gnu.org/releases/freetype/freetype-${FREETYPE_VERSION}.tar.gz && \ |
| 36 | + tar -xf freetype-${FREETYPE_VERSION}.tar.gz && \ |
| 37 | + cd freetype-${FREETYPE_VERSION} && \ |
| 38 | + ./configure --prefix="/ffmpeg_build" --enable-freetype-config && \ |
| 39 | + make && \ |
| 40 | + make install && \ |
| 41 | + cd .. && \ |
| 42 | + rm -rf ~/freetype_sources |
| 43 | + |
| 44 | +RUN curl -O -L https://download.qt.io/archive/qt/5.15/${QT_VERSION}/single/qt-everywhere-opensource-src-${QT_VERSION}.tar.xz && \ |
| 45 | + tar -xf qt-everywhere-opensource-src-${QT_VERSION}.tar.xz && \ |
| 46 | + cd qt-everywhere-src-${QT_VERSION} && \ |
| 47 | + export MAKEFLAGS=-j$(nproc) && \ |
| 48 | + ./configure -prefix /opt/Qt${QT_VERSION} -release -opensource -confirm-license -qtnamespace QtOpenCVPython -xcb -xcb-xlib -bundled-xcb-xinput -no-openssl -no-dbus -skip qt3d -skip qtactiveqt -skip qtcanvas3d -skip qtconnectivity -skip qtdatavis3d -skip qtdoc -skip qtgamepad -skip qtgraphicaleffects -skip qtimageformats -skip qtlocation -skip qtmultimedia -skip qtpurchasing -skip qtqa -skip qtremoteobjects -skip qtrepotools -skip qtscript -skip qtscxml -skip qtsensors -skip qtserialbus -skip qtserialport -skip qtspeech -skip qttranslations -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebsockets -skip qtwebview -skip xmlpatterns -skip declarative -make libs && \ |
| 49 | + make && \ |
| 50 | + make install && \ |
| 51 | + cd .. && \ |
| 52 | + rm -rf qt-everywhere* |
| 53 | + |
| 54 | +ENV QTDIR /opt/Qt${QT_VERSION} |
| 55 | +ENV PATH "$QTDIR/bin:$PATH" |
| 56 | + |
| 57 | +RUN mkdir ~/libvpx_sources && \ |
| 58 | + cd ~/libvpx_sources && \ |
| 59 | + git clone --depth 1 -b ${VPX_VERSION} https://chromium.googlesource.com/webm/libvpx.git && \ |
| 60 | + cd libvpx && \ |
| 61 | + ./configure --prefix="/ffmpeg_build" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm --enable-pic --enable-shared && \ |
| 62 | + make -j$(getconf _NPROCESSORS_ONLN) && \ |
| 63 | + make install && \ |
| 64 | + cd .. && \ |
| 65 | + rm -rf ~/libvpx_sources |
| 66 | + |
| 67 | +RUN mkdir ~/aom_sources && \ |
| 68 | + cd ~/aom_sources && \ |
| 69 | + git clone --depth 1 -b ${AOM_VERSION} https://aomedia.googlesource.com/aom && \ |
| 70 | + mkdir build && cd build && \ |
| 71 | + cmake -DCMAKE_C_COMPILER=$(dirname $(which g++))/gcc -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_SHARED_LIBS=ON -DENABLE_TESTS=OFF ../aom/ && \ |
| 72 | + make -j$(getconf _NPROCESSORS_ONLN) && \ |
| 73 | + make install && \ |
| 74 | + cd / && rm -rf ~/aom_sources |
| 75 | + |
| 76 | +RUN mkdir ~/avif_sources && \ |
| 77 | + cd ~/avif_sources && \ |
| 78 | + git clone -b ${AVIF_VERSION} https://github.com/AOMediaCodec/libavif.git && \ |
| 79 | + mkdir build && cd build && \ |
| 80 | + cmake -DCMAKE_INSTALL_PREFIX=/usr -DAVIF_CODEC_AOM=SYSTEM -DAVIF_LIBYUV=LOCAL -DAVIF_BUILD_APPS=OFF ../libavif && \ |
| 81 | + make -j$(getconf _NPROCESSORS_ONLN) && \ |
| 82 | + make install && \ |
| 83 | + cd / && rm -rf ~/avif_sources |
| 84 | + |
| 85 | +RUN mkdir ~/ffmpeg_sources && \ |
| 86 | + cd ~/ffmpeg_sources && \ |
| 87 | + curl -O -L https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.gz && \ |
| 88 | + tar -xf ffmpeg-${FFMPEG_VERSION}.tar.gz && \ |
| 89 | + cd ffmpeg-${FFMPEG_VERSION} && \ |
| 90 | + PATH=~/bin:$PATH && \ |
| 91 | + PKG_CONFIG_PATH="/ffmpeg_build/lib/pkgconfig" ./configure --prefix="/ffmpeg_build" --extra-cflags="-I/ffmpeg_build/include" --extra-ldflags="-L/ffmpeg_build/lib" --enable-openssl --enable-libvpx --enable-shared --enable-pic --bindir="$HOME/bin" && \ |
| 92 | + make -j$(getconf _NPROCESSORS_ONLN) && \ |
| 93 | + make install && \ |
| 94 | + echo "/ffmpeg_build/lib/" >> /etc/ld.so.conf && \ |
| 95 | + ldconfig && \ |
| 96 | + rm -rf ~/ffmpeg_sources |
| 97 | + |
| 98 | +# GitHub Actions user`s UID is 1001 |
| 99 | +RUN useradd ci -m -s /bin/bash -G users --uid=1001 && \ |
| 100 | + mkdir /io && \ |
| 101 | + chown -R ci:ci /io && \ |
| 102 | + # This needs to find ffmpeg packages from ci user |
| 103 | + chown -R ci:ci /ffmpeg_build && \ |
| 104 | + # This calls in mutlibuild scripts and cannot be run without permissions |
| 105 | + chown -R ci:ci /opt/_internal/pipx/venvs/auditwheel |
| 106 | + |
| 107 | +USER ci |
| 108 | + |
| 109 | +# Git security vulnerability: https://github.blog/2022-04-12-git-security-vulnerability-announced |
| 110 | +RUN git config --global --add safe.directory /io |
| 111 | + |
| 112 | +ENV PKG_CONFIG_PATH /usr/local/lib/pkgconfig:/ffmpeg_build/lib/pkgconfig |
| 113 | +ENV LDFLAGS -L/ffmpeg_build/lib |
| 114 | +ENV PATH "$HOME/bin:$PATH" |
0 commit comments