Use BuildKit features to reduce amount of layers

This commit is contained in:
BtbN 2021-04-05 19:22:03 +02:00
parent e20a907e31
commit e38500bb7d
58 changed files with 8 additions and 281 deletions

View file

@ -1,7 +1,7 @@
#!/bin/bash
set -xe
mkdir -p /stage
source "$1"
cd /stage
source /stage.sh
ffbuild_dockerbuild
rm -rf /stage /stage.sh "$FFBUILD_PREFIX"/bin
rm -rf /stage "$FFBUILD_PREFIX"/bin

View file

@ -8,11 +8,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
git-mini-clone "$MINGW_REPO" "$MINGW_COMMIT" mingw
cd mingw/mingw-w64-headers

View file

@ -7,11 +7,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
mkdir iconv
cd iconv

View file

@ -6,11 +6,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
mkdir zlib
cd zlib

View file

@ -7,11 +7,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
git-mini-clone "$LIBXML2_REPO" "$LIBXML2_COMMIT" libxml2
cd libxml2

View file

@ -7,11 +7,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
mkdir ft
cd ft

View file

@ -7,11 +7,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
git-mini-clone "$FRIBIDI_REPO" "$FRIBIDI_COMMIT" fribidi
cd fribidi

View file

@ -6,11 +6,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
mkdir gmp
cd gmp

View file

@ -7,11 +7,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
git-mini-clone "$OGG_REPO" "$OGG_COMMIT" ogg
cd ogg

View file

@ -7,11 +7,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
git-mini-clone "$OPENSSL_REPO" "$OPENSSL_COMMIT" openssl
cd openssl

View file

@ -6,11 +6,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
mkdir xz
cd xz

View file

@ -6,11 +6,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
mkdir fc
cd fc

View file

@ -10,11 +10,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
mkdir fftw3
cd fftw3

View file

@ -7,11 +7,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
git-mini-clone "$HARFBUZZ_REPO" "$HARFBUZZ_COMMIT" harfbuzz
cd harfbuzz

View file

@ -9,11 +9,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
git-mini-clone "$LIBSR_REPO" "$LIBSR_COMMIT" libsr
cd libsr

View file

@ -7,11 +7,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
git-mini-clone "$LIBUDFREAD_REPO" "$LIBUDFREAD_COMMIT" libudfread
cd libudfread

View file

@ -7,11 +7,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
git-mini-clone "$LV2_REPO" "$LV2_COMMIT" lv2
cd lv2

View file

@ -10,11 +10,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
mkdir opencl && cd opencl

View file

@ -7,11 +7,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
git-mini-clone "$SERD_REPO" "$SERD_COMMIT" serd
cd serd

View file

@ -7,11 +7,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
git-mini-clone "$VMAF_REPO" "$VMAF_COMMIT" vmaf
cd vmaf

View file

@ -8,16 +8,14 @@ ffbuild_enabled() {
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "ADD patches/vulkan /stage/patches"
to_df "RUN run_stage"
to_df "RUN --mount=src=${SELF},dst=/stage.sh --mount=src=patches/vulkan,dst=/patches run_stage /stage.sh"
}
ffbuild_dockerbuild() {
git clone "$LOADER_REPO" loader
git -C loader checkout "$LOADER_COMMIT"
for patch in patches/*.patch; do
for patch in /patches/*.patch; do
echo "Applying $patch"
git -C loader am -3 < "$patch"
done

View file

@ -7,11 +7,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
git-mini-clone "$SORD_REPO" "$SORD_COMMIT" sord
cd sord

View file

@ -7,11 +7,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
git-mini-clone "$SRATOM_REPO" "$SRATOM_COMMIT" sratom
cd sratom

View file

@ -7,11 +7,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
git-mini-clone "$VORBIS_REPO" "$VORBIS_COMMIT" vorbis
cd vorbis

View file

@ -7,11 +7,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
git-mini-clone "$AMF_REPO" "$AMF_COMMIT" amf
cd amf

View file

@ -7,11 +7,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
git-mini-clone "$AOM_REPO" "$AOM_COMMIT" aom
cd aom

View file

@ -8,11 +8,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
git-mini-clone "$AVISYNTH_REPO" "$AVISYNTH_COMMIT" avisynth
cd avisynth

View file

@ -7,11 +7,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
git-mini-clone "$DAV1D_REPO" "$DAV1D_COMMIT" dav1d
cd dav1d

View file

@ -9,11 +9,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
git clone "$DAVS2_REPO" davs2
cd davs2

View file

@ -7,11 +7,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
git-mini-clone "$FFNVCODEC_REPO" "$FFNVCODEC_COMMIT" ffnvcodec
cd ffnvcodec

View file

@ -7,11 +7,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
git-mini-clone "$GLSLANG_REPO" "$GLSLANG_COMMIT" glslang
cd glslang

View file

@ -7,11 +7,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
git clone "$GME_REPO" gme
cd gme

View file

@ -7,11 +7,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
git-mini-clone "$ASS_REPO" "$ASS_COMMIT" ass
cd ass

View file

@ -7,11 +7,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
git-mini-clone "$LIBBLURAY_REPO" "$LIBBLURAY_COMMIT" libbluray
cd libbluray

View file

@ -6,11 +6,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
mkdir lame
cd lame

View file

@ -7,11 +7,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
git-mini-clone "$OPUS_REPO" "$OPUS_COMMIT" opus
cd opus

View file

@ -7,11 +7,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
git-mini-clone "$THEORA_REPO" "$THEORA_COMMIT" theora
cd theora

View file

@ -7,11 +7,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
git-mini-clone "$LIBVPX_REPO" "$LIBVPX_COMMIT" libvpx
cd libvpx

View file

@ -7,11 +7,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
git-mini-clone "$WEBP_REPO" "$WEBP_COMMIT" webp
cd webp

View file

@ -7,11 +7,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
git-mini-clone "$LILV_REPO" "$LILV_COMMIT" lilv
cd lilv

View file

@ -7,11 +7,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
git-mini-clone "$MFX_REPO" "$MFX_COMMIT" mfx
cd mfx

View file

@ -6,11 +6,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
mkdir opencore
cd opencore

View file

@ -7,11 +7,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
git-mini-clone "$OPENJPEG_REPO" "$OPENJPEG_COMMIT" openjpeg
cd openjpeg

View file

@ -8,11 +8,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
git-mini-clone "$RAV1E_REPO" "$RAV1E_COMMIT" rav1e
cd rav1e

View file

@ -8,11 +8,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
mkdir rubberband
cd rubberband

View file

@ -6,11 +6,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
mkdir sdl
cd sdl

View file

@ -8,11 +8,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
git-mini-clone "$SOXR_REPO" "$SOXR_COMMIT" soxr
cd soxr

View file

@ -7,11 +7,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
git-mini-clone "$SRT_REPO" "$SRT_COMMIT" srt
cd srt

View file

@ -9,11 +9,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
git clone "$SVTAV1_REPO" svtav1
cd svtav1

View file

@ -6,11 +6,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
mkdir twolame
cd twolame

View file

@ -9,11 +9,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
git clone "$UAVS3D_REPO" uavs3d
cd uavs3d

View file

@ -9,11 +9,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
git-mini-clone "$VIDSTAB_REPO" "$VIDSTAB_COMMIT" vidstab
cd vidstab

View file

@ -8,11 +8,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
git-mini-clone "$X264_REPO" "$X264_COMMIT" x264
cd x264

View file

@ -8,11 +8,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
git clone "$X265_REPO" x265
cd x265

View file

@ -9,11 +9,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
git clone "$XAVS2_REPO" xavs2
cd xavs2

View file

@ -7,11 +7,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
mkdir xvid
cd xvid

View file

@ -7,11 +7,6 @@ ffbuild_enabled() {
return 0
}
ffbuild_dockerstage() {
to_df "ADD $SELF /stage.sh"
to_df "RUN run_stage"
}
ffbuild_dockerbuild() {
git-mini-clone "$ZIMG_REPO" "$ZIMG_COMMIT" zimg
cd zimg

View file

@ -35,6 +35,10 @@ BASE_IMAGE="${REGISTRY}/${REPO}/base:latest"
TARGET_IMAGE="${REGISTRY}/${REPO}/base-${TARGET}:latest"
IMAGE="${REGISTRY}/${REPO}/${TARGET}-${VARIANT}${ADDINS_STR:+-}${ADDINS_STR}:latest"
ffbuild_dockerstage() {
to_df "RUN --mount=src=${SELF},dst=/stage.sh run_stage /stage.sh"
}
ffbuild_configure() {
return 0
}