From 7536f5d46fe8212d7351a1775225bfe6c8413246 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Mon, 14 Mar 2022 23:16:45 +0100 Subject: [PATCH 1/3] Improve Docker caching. --- CHANGELOG.md | 7 ++++--- build-docker-image.sh | 23 +++++++++++++++++------ 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d2d7416bd..88ad18124 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,15 +5,16 @@ This project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] +- #650 - Improve Docker caching. - #588 - fix ci: bump openssl version in freebsd again - #552 - Added CHANGELOG.md automation - #543 - Added environment variables to control the UID and GID in the container - #534 - fix image builds with update of dependencies - #502 - fix ci: bump openssl version in freebsd -- #501 - x86_64-linux: lower glibc version requirement to 2.17 (compatible with centos 7) -- #500 - use runner setting specified in Cross.toml +- #501 - x86_64-linux: lower glibc version requirement to 2.17 (compatible with centos 7) +- #500 - use runner setting specified in Cross.toml - #498 - bump linux-image version to fix CI -- #497 - don't set RUSTFLAGS in aarch64-musl image +- #497 - don't set RUSTFLAGS in aarch64-musl image - #492 - Add cmake to FreeBSD images - #489 - Add support for more hosts and simplify/unify host support checks - #477 - Fix Docker/Podman links in README diff --git a/build-docker-image.sh b/build-docker-image.sh index 13b4f1a5f..b6f061687 100755 --- a/build-docker-image.sh +++ b/build-docker-image.sh @@ -66,17 +66,28 @@ run() { ;; esac - build_args+=(--pull) + build_args+=( + --pull + --cache-from "type=registry,ref=${image_name}:main" + ) + + if "${push}"; then + build_args+=(--cache-to 'type=inline') + fi if [[ -n "${GITHUB_ACTIONS-}" ]]; then - build_args+=( - --cache-from "type=gha,url=${ACTIONS_CACHE_URL},token=${ACTIONS_RUNTIME_TOKEN}" - --cache-to "type=gha,mode=max,url=${ACTIONS_CACHE_URL},token=${ACTIONS_RUNTIME_TOKEN}" - ) + build_args+=(--cache-from "type=gha,url=${ACTIONS_CACHE_URL},token=${ACTIONS_RUNTIME_TOKEN}") + + if ! "${push}"; then + build_args+=(--cache-to "type=gha,mode=max,url=${ACTIONS_CACHE_URL},token=${ACTIONS_RUNTIME_TOKEN}") + fi fi for tag in "${tags[@]}"; do - build_args+=(--tag "${tag}") + build_args+=( + --cache-from "type=registry,ref=${tag}" + --tag "${tag}" + ) done docker buildx build "${build_args[@]}" -f "${dockerfile}" --progress plain . From be9e90eab82004f76cd54e3f8fbb07d90526d09b Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Tue, 15 Mar 2022 16:39:01 +0100 Subject: [PATCH 2/3] Only cache from `main` tag. --- build-docker-image.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/build-docker-image.sh b/build-docker-image.sh index b6f061687..508d9a559 100755 --- a/build-docker-image.sh +++ b/build-docker-image.sh @@ -84,10 +84,7 @@ run() { fi for tag in "${tags[@]}"; do - build_args+=( - --cache-from "type=registry,ref=${tag}" - --tag "${tag}" - ) + build_args+=(--tag "${tag}") done docker buildx build "${build_args[@]}" -f "${dockerfile}" --progress plain . From 84852d87de61bc70a36107ca9bc37af2f00917d8 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Tue, 15 Mar 2022 22:28:44 +0100 Subject: [PATCH 3/3] Fix `powerpc64` kernel version. --- docker/linux-image.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/linux-image.sh b/docker/linux-image.sh index 01b595015..b878745c1 100755 --- a/docker/linux-image.sh +++ b/docker/linux-image.sh @@ -58,7 +58,7 @@ main() { # there is no stable port arch=ppc64 # https://packages.debian.org/en/sid/linux-image-powerpc64 - kversion='5.16.0-4' + kversion='5.*' kernel="${kversion}-powerpc64" libgcc="libgcc-s1" debsource="deb http://ftp.ports.debian.org/debian-ports unstable main"