Skip to content

Commit

Permalink
Merge branch 'lukas/gh/debug-docker-build-cache' into maint
Browse files Browse the repository at this point in the history
* lukas/gh/debug-docker-build-cache:
  gh: Update docker builds to use inline cache
  • Loading branch information
garazdawi committed Feb 17, 2025
2 parents 9c7e687 + 4ae7b8b commit d98f940
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions .github/scripts/build-base-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,21 @@ else
if [ "${BASE_USE_CACHE}" != "false" ]; then
if docker pull "${BASE_TAG}:${BASE_BRANCH}"; then
docker tag "${BASE_TAG}:${BASE_BRANCH}" "${BASE_TAG}:latest"
BASE_CACHE="--cache-from ${BASE_TAG}"
fi
BASE_CACHE="--cache-from type=registry,ref=${BASE_TAG}:${BASE_BRANCH}"
fi

BASE_IMAGE_ID=$(docker images -q "${BASE_TAG}:latest")

docker build --pull --tag "${BASE_TAG}:latest" \
DOCKER_BUILDKIT=1 docker build --pull --tag "${BASE_TAG}:latest" \
${BASE_CACHE} \
--file ".github/dockerfiles/Dockerfile.${BASE_TYPE}" \
--build-arg MAKEFLAGS=-j$(($(nproc) + 2)) \
--build-arg MAKEFLAGS=-j6 \
--build-arg USER=otptest --build-arg GROUP=uucp \
--build-arg uid="$(id -u)" \
--build-arg BASE="${BASE}" .github/
--build-arg BASE="${BASE}" \
--build-arg BUILDKIT_INLINE_CACHE=1 \
.github/

NEW_BASE_IMAGE_ID=$(docker images -q "${BASE_TAG}:latest")
if [ "${BASE_IMAGE_ID}" = "${NEW_BASE_IMAGE_ID}" ]; then
Expand Down

0 comments on commit d98f940

Please sign in to comment.