|
| 1 | +# |
| 2 | +FROM quay.io/pypa/musllinux_1_2_x86_64:latest |
| 3 | + |
| 4 | +ARG CCACHE_VERSION=3.7.9 |
| 5 | +ARG FFMPEG_VERSION=6.1.1 |
| 6 | +ARG FREETYPE_VERSION=2.13.3 |
| 7 | +ARG LIBPNG_VERSION=1.6.48 |
| 8 | +ARG VPX_VERSION=v1.15.1 |
| 9 | +ARG NASM_VERSION=2.15.04 |
| 10 | +ARG OPENSSL_VERSION=1_1_1w |
| 11 | +ARG YASM_VERSION=1.3.0 |
| 12 | +ARG AOM_VERSION=v3.12.1 |
| 13 | +ARG AVIF_VERSION=v1.3.0 |
| 14 | + |
| 15 | +ENV LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH |
| 16 | + |
| 17 | +RUN apk add --no-cache \ |
| 18 | + build-base \ |
| 19 | + diffutils \ |
| 20 | + cmake \ |
| 21 | + bash \ |
| 22 | + git \ |
| 23 | + curl \ |
| 24 | + wget \ |
| 25 | + tar \ |
| 26 | + xz \ |
| 27 | + zlib-dev \ |
| 28 | + xz-dev \ |
| 29 | + nasm \ |
| 30 | + yasm \ |
| 31 | + pkgconfig \ |
| 32 | + openssl-dev \ |
| 33 | + libjpeg-turbo-dev \ |
| 34 | + fontconfig-dev \ |
| 35 | + freetype-dev \ |
| 36 | + expat-dev \ |
| 37 | + libpng-dev \ |
| 38 | + alsa-lib-dev \ |
| 39 | + musl-dev \ |
| 40 | + ttf-dejavu \ |
| 41 | + linux-headers \ |
| 42 | + perl |
| 43 | + |
| 44 | +RUN apk del libpng-dev |
| 45 | + |
| 46 | +### libpng |
| 47 | +RUN mkdir ~/libpng_sources && \ |
| 48 | + cd ~/libpng_sources && \ |
| 49 | + curl -O -L https://download.sourceforge.net/libpng/libpng-${LIBPNG_VERSION}.tar.gz && \ |
| 50 | + tar -xf libpng-${LIBPNG_VERSION}.tar.gz && \ |
| 51 | + cd libpng-${LIBPNG_VERSION} && \ |
| 52 | + ./configure --prefix=/usr/local && \ |
| 53 | + make && \ |
| 54 | + make install && \ |
| 55 | + cd .. && \ |
| 56 | + rm -rf ~/libpng_sources |
| 57 | + |
| 58 | +### freetype |
| 59 | +RUN mkdir ~/freetype_sources && \ |
| 60 | + cd ~/freetype_sources && \ |
| 61 | + curl -O -L https://download.savannah.gnu.org/releases/freetype/freetype-${FREETYPE_VERSION}.tar.gz && \ |
| 62 | + tar -xf freetype-${FREETYPE_VERSION}.tar.gz && \ |
| 63 | + cd freetype-${FREETYPE_VERSION} && \ |
| 64 | + ./configure --prefix="/ffmpeg_build" --enable-freetype-config && \ |
| 65 | + make && \ |
| 66 | + make install && \ |
| 67 | + cd .. && \ |
| 68 | + rm -rf ~/freetype_sources |
| 69 | + |
| 70 | +### OpenSSL |
| 71 | +RUN mkdir ~/openssl_sources && \ |
| 72 | + cd ~/openssl_sources && \ |
| 73 | + curl -O -L https://github.com/openssl/openssl/archive/OpenSSL_${OPENSSL_VERSION}.tar.gz && \ |
| 74 | + tar -xf OpenSSL_${OPENSSL_VERSION}.tar.gz && \ |
| 75 | + cd openssl-OpenSSL_${OPENSSL_VERSION} && \ |
| 76 | + ./config --prefix="/ffmpeg_build" --openssldir="/ffmpeg_build" no-pinshared shared zlib && \ |
| 77 | + make -j$(getconf _NPROCESSORS_ONLN) && \ |
| 78 | + make install_sw && \ |
| 79 | + cd .. && \ |
| 80 | + rm -rf ~/openssl_build ~/openssl_sources |
| 81 | + |
| 82 | +### libvpx |
| 83 | +RUN mkdir ~/libvpx_sources && \ |
| 84 | + cd ~/libvpx_sources && \ |
| 85 | + git clone --depth 1 -b ${VPX_VERSION} https://chromium.googlesource.com/webm/libvpx.git && \ |
| 86 | + cd libvpx && \ |
| 87 | + ./configure --prefix="/ffmpeg_build" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm --enable-pic --enable-shared && \ |
| 88 | + make -j$(getconf _NPROCESSORS_ONLN) && \ |
| 89 | + make install && \ |
| 90 | + cd .. && \ |
| 91 | + rm -rf ~/libvpx_sources |
| 92 | + |
| 93 | + |
| 94 | +### aom |
| 95 | +RUN mkdir -p /tmp/aom_sources && \ |
| 96 | + cd /tmp/aom_sources && \ |
| 97 | + git clone --depth 1 -b ${AOM_VERSION} https://aomedia.googlesource.com/aom && \ |
| 98 | + mkdir build && cd build && \ |
| 99 | + cmake \ |
| 100 | + -DCMAKE_C_COMPILER=$(dirname $(which g++))/gcc \ |
| 101 | + -DCMAKE_INSTALL_PREFIX=/usr \ |
| 102 | + -DBUILD_SHARED_LIBS=ON \ |
| 103 | + -DENABLE_TESTS=OFF \ |
| 104 | + -DENABLE_EXAMPLES=OFF \ |
| 105 | + ../aom && \ |
| 106 | + make -j$(getconf _NPROCESSORS_ONLN) && \ |
| 107 | + make install |
| 108 | +### avif |
| 109 | +RUN mkdir ~/avif_sources && \ |
| 110 | + cd ~/avif_sources && \ |
| 111 | + git clone -b ${AVIF_VERSION} https://github.com/AOMediaCodec/libavif.git && \ |
| 112 | + mkdir build && cd build && \ |
| 113 | + cmake -DCMAKE_INSTALL_PREFIX=/usr -DAVIF_CODEC_AOM=SYSTEM -DAVIF_LIBYUV=LOCAL -DAVIF_BUILD_APPS=OFF ../libavif && \ |
| 114 | + make -j$(getconf _NPROCESSORS_ONLN) && \ |
| 115 | + make install && \ |
| 116 | + cd .. && \ |
| 117 | + rm -rf ~/avif_sources |
| 118 | + |
| 119 | +### ffmpeg |
| 120 | +RUN mkdir -p /ffmpeg_sources && \ |
| 121 | + cd /ffmpeg_sources && \ |
| 122 | + curl -LO https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.gz && \ |
| 123 | + tar -xf ffmpeg-${FFMPEG_VERSION}.tar.gz && \ |
| 124 | + cd ffmpeg-${FFMPEG_VERSION} && \ |
| 125 | + PKG_CONFIG_PATH="/ffmpeg_build/lib/pkgconfig" ./configure \ |
| 126 | + --prefix="/ffmpeg_build" \ |
| 127 | + --extra-cflags="-I/ffmpeg_build/include" \ |
| 128 | + --extra-ldflags="-L/ffmpeg_build/lib" \ |
| 129 | + --enable-openssl \ |
| 130 | + --enable-libvpx \ |
| 131 | + --enable-shared \ |
| 132 | + --enable-pic \ |
| 133 | + --disable-indev=v4l2 \ |
| 134 | + --disable-outdev=v4l2 && \ |
| 135 | + make -j$(getconf _NPROCESSORS_ONLN) && \ |
| 136 | + make install && \ |
| 137 | + rm -rf /ffmpeg_sources |
| 138 | + |
| 139 | +### ccache |
| 140 | +RUN curl -O -L https://github.com/ccache/ccache/releases/download/v${CCACHE_VERSION}/ccache-${CCACHE_VERSION}.tar.gz && \ |
| 141 | + tar -xf ccache-${CCACHE_VERSION}.tar.gz && \ |
| 142 | + cd ccache-${CCACHE_VERSION} && \ |
| 143 | + ./configure && \ |
| 144 | + make -j$(getconf _NPROCESSORS_ONLN) && \ |
| 145 | + make install && \ |
| 146 | + cd .. && \ |
| 147 | + rm -rf ccache-${CCACHE_VERSION}.tar.gz |
| 148 | + |
| 149 | +# user`s UID is 1001 |
| 150 | +RUN adduser -D -u 1001 ci && mkdir /io && chown ci:ci /io && \ |
| 151 | + chown -R ci:ci /ffmpeg_build |
| 152 | + |
| 153 | +USER ci |
| 154 | + |
| 155 | +RUN git config --global --add safe.directory /io |
| 156 | +ENV PATH="/ffmpeg_build/bin:$PATH" |
| 157 | +ENV PKG_CONFIG_PATH /usr/local/lib/pkgconfig:/ffmpeg_build/lib/pkgconfig |
| 158 | +ENV LDFLAGS -L/ffmpeg_build/lib |
| 159 | +ENV PATH "$HOME/bin:$PATH" |
| 160 | +ENV LD_LIBRARY_PATH="/ffmpeg_build/lib:$LD_LIBRARY_PATH" |
0 commit comments