Dockerfile_aarch64 6.5 KB
Newer Older
1
# Version: 20221205
2 3
# Image name: quay.io/opencv-ci/opencv-python-manylinux2014-aarch64

O
Olli-Pekka Heinisuo 已提交
4 5
FROM quay.io/pypa/manylinux2014_aarch64:latest

6
ARG CCACHE_VERSION=3.7.9
A
Alexander Smorkalov 已提交
7
ARG FFMPEG_VERSION=5.1.2
8 9
ARG FREETYPE_VERSION=2.12.1
ARG LIBPNG_VERSION=1.6.37
10
ARG NASM_VERSION=2.15.04
A
Alexander Smorkalov 已提交
11
ARG OPENSSL_VERSION=1_1_1s
12 13
ARG QT_VERSION=5.15.0
ARG YASM_VERSION=1.3.0
14
ARG ZLIB_VERSION=1.2.13
15

16 17 18
ENV LD_LIBRARY_PATH /usr/local/lib:$LD_LIBRARY_PATH

# epel-release need for aarch64 to get openblas packages
19
RUN yum install bzip2-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 && \
A
Alexander Smorkalov 已提交
20
    yum install openblas-devel dejavu-sans-fonts -y && \
21 22 23
    cp /usr/include/lapacke/lapacke*.h /usr/include/ && \
    curl https://raw.githubusercontent.com/xianyi/OpenBLAS/v0.3.3/cblas.h -o /usr/include/cblas.h && \
    # libpng will be built from source
24 25 26 27 28 29 30 31 32 33 34 35
    yum remove libpng zlib-devel bzip2-devel -y

RUN mkdir ~/zlib_sources && \
    cd ~/zlib_sources && \
    curl -O -L https://www.zlib.net/zlib-${ZLIB_VERSION}.tar.gz && \
    tar -xf zlib-${ZLIB_VERSION}.tar.gz && \
    cd zlib-${ZLIB_VERSION} && \
    ./configure --prefix=/usr/local && \
    make && \
    make install && \
    cd .. && \
    rm -rf ~/zlib_sources
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52

RUN mkdir ~/libpng_sources && \
    cd ~/libpng_sources && \
    curl -O -L https://download.sourceforge.net/libpng/libpng-${LIBPNG_VERSION}.tar.gz && \
    tar -xf libpng-${LIBPNG_VERSION}.tar.gz && \
    cd libpng-${LIBPNG_VERSION} && \
    ./configure --prefix=/usr/local && \
    make && \
    make install && \
    cd .. && \
    rm -rf ~/libpng_sources

RUN mkdir ~/freetype_sources && \
    cd ~/freetype_sources && \
    curl -O -L https://download.savannah.gnu.org/releases/freetype/freetype-${FREETYPE_VERSION}.tar.gz && \
    tar -xf freetype-${FREETYPE_VERSION}.tar.gz && \
    cd freetype-${FREETYPE_VERSION} && \
53
    ./configure --prefix="/ffmpeg_build" --enable-freetype-config && \
54 55 56 57
    make && \
    make install && \
    cd .. && \
    rm -rf ~/freetype_sources
O
Olli-Pekka Heinisuo 已提交
58

59 60
RUN curl -O -L https://download.qt.io/official_releases/qt/5.15/${QT_VERSION}/single/qt-everywhere-src-${QT_VERSION}.tar.xz && \
    tar -xf qt-everywhere-src-${QT_VERSION}.tar.xz && \
61
    cd qt-everywhere-src-${QT_VERSION} && \
O
Olli-Pekka Heinisuo 已提交
62
    export MAKEFLAGS=-j$(nproc) && \
63
    ./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 && \
O
Olli-Pekka Heinisuo 已提交
64 65 66
    make && \
    make install && \
    cd .. && \
67
    rm -rf qt-everywhere*
O
Olli-Pekka Heinisuo 已提交
68

69
ENV QTDIR /opt/Qt${QT_VERSION}
O
Olli-Pekka Heinisuo 已提交
70 71
ENV PATH "$QTDIR/bin:$PATH"

72 73
RUN mkdir ~/openssl_sources && \
    cd ~/openssl_sources && \
74 75 76
    curl -O -L https://github.com/openssl/openssl/archive/OpenSSL_${OPENSSL_VERSION}.tar.gz && \
    tar -xf OpenSSL_${OPENSSL_VERSION}.tar.gz && \
    cd openssl-OpenSSL_${OPENSSL_VERSION} && \
77
    ./config --prefix="/ffmpeg_build" --openssldir="/ffmpeg_build" no-pinshared shared zlib && \
O
Olli-Pekka Heinisuo 已提交
78 79 80
    make -j$(getconf _NPROCESSORS_ONLN) && \
    # skip installing documentation
    make install_sw && \
81 82
    cd .. && \
    rm -rf ~/openssl_build ~/openssl_sources
O
Olli-Pekka Heinisuo 已提交
83

84 85
RUN mkdir ~/nasm_sources && \
    cd ~/nasm_sources && \
86 87
    curl -O -L http://www.nasm.us/pub/nasm/releasebuilds/${NASM_VERSION}/nasm-${NASM_VERSION}.tar.gz && \
    tar -xf nasm-${NASM_VERSION}.tar.gz && cd nasm-${NASM_VERSION} && ./autogen.sh && \
88
    ./configure --prefix="/ffmpeg_build" --bindir="$HOME/bin" && \
O
Olli-Pekka Heinisuo 已提交
89
    make -j$(getconf _NPROCESSORS_ONLN) && \
90 91 92
    make install && \
    cd .. && \
    rm -rf ~/nasm_sources
O
Olli-Pekka Heinisuo 已提交
93

94 95
RUN mkdir ~/yasm_sources && \
    cd ~/yasm_sources && \
96 97 98
    curl -O -L http://www.tortall.net/projects/yasm/releases/yasm-${YASM_VERSION}.tar.gz && \
    tar -xf yasm-${YASM_VERSION}.tar.gz && \
    cd yasm-${YASM_VERSION} && \
99
    ./configure --prefix="/ffmpeg_build" --bindir="$HOME/bin" && \
O
Olli-Pekka Heinisuo 已提交
100
    make -j$(getconf _NPROCESSORS_ONLN) && \
101 102 103
    make install && \
    cd .. && \
    rm -rf ~/yasm_sources
O
Olli-Pekka Heinisuo 已提交
104

105 106 107
RUN mkdir ~/libvpx_sources && \
    cd ~/libvpx_sources && \
    git clone --depth 1 https://github.com/webmproject/libvpx.git && \
O
Olli-Pekka Heinisuo 已提交
108
    cd libvpx && \
109
    ./configure --prefix="/ffmpeg_build" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm --enable-pic --enable-shared && \
O
Olli-Pekka Heinisuo 已提交
110
    make -j$(getconf _NPROCESSORS_ONLN) && \
111 112 113
    make install && \
    cd .. && \
    rm -rf ~/libvpx_sources
O
Olli-Pekka Heinisuo 已提交
114

115 116
RUN mkdir ~/ffmpeg_sources && \
    cd ~/ffmpeg_sources && \
117 118
    curl -O -L https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.gz && \
    tar -xf ffmpeg-${FFMPEG_VERSION}.tar.gz && \
119
    cd ffmpeg-${FFMPEG_VERSION} && \
O
Olli-Pekka Heinisuo 已提交
120
    PATH=~/bin:$PATH && \
121
    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" && \
O
Olli-Pekka Heinisuo 已提交
122 123
    make -j$(getconf _NPROCESSORS_ONLN) && \
    make install && \
124
    echo "/ffmpeg_build/lib/" >> /etc/ld.so.conf && \
O
Olli-Pekka Heinisuo 已提交
125
    ldconfig && \
126
    rm -rf ~/ffmpeg_sources
O
Olli-Pekka Heinisuo 已提交
127

128 129 130
RUN curl -O -L https://github.com/ccache/ccache/releases/download/v${CCACHE_VERSION}/ccache-${CCACHE_VERSION}.tar.gz && \
    tar -xf ccache-${CCACHE_VERSION}.tar.gz && \
    cd ccache-${CCACHE_VERSION} && \
131 132
    linux32 ./configure && \
    make -j$(getconf _NPROCESSORS_ONLN) && \
133 134 135
    make install && \
    cd .. && \
    rm -rf ccache-${CCACHE_VERSION}.tar.gz
136

137 138 139 140 141 142 143 144 145 146 147
# Self-hosted runner UID is 1004
RUN useradd ci -m -s /bin/bash -G users --uid=1004 && \
    mkdir /io && \
    chown -R ci:ci /io && \
    # This needs to find ffmpeg packages from ci user
    chown -R ci:ci /ffmpeg_build && \
    # This calls in mutlibuild scripts and cannot be run without permissions
    chown -R ci:ci /opt/_internal/pipx/venvs/auditwheel

USER ci

148
# Git security vulnerability: https://github.blog/2022-04-12-git-security-vulnerability-announced
149
RUN git config --global --add safe.directory /io
150

151 152
ENV PKG_CONFIG_PATH /usr/local/lib/pkgconfig:/ffmpeg_build/lib/pkgconfig
ENV LDFLAGS -L/ffmpeg_build/lib
O
Olli-Pekka Heinisuo 已提交
153
ENV PATH "$HOME/bin:$PATH"