ci: use buildx in ci

Github-Pull: #32989
Rebased-From: 94a0932547

This rebase also includes part of e87429a2d0
adding `$DOCKER_BUILD_CACHE_ARG \` to the `docker build` command.

Using buildx is required to properly load the correct driver, for use
with registry caching. Neither build, nor BUILDKIT=1 currently do this
properly.

Use of `docker buildx build` is compatible with podman.
This commit is contained in:
will 2025-08-05 14:41:09 +01:00
parent f8cb31d064
commit f6ccd895df
No known key found for this signature in database
GPG Key ID: CE6EC49945C17EA6
1 changed files with 5 additions and 1 deletions

View File

@ -17,11 +17,15 @@ if [ -z "$DANGER_RUN_CI_ON_HOST" ]; then
docker run --rm "${CI_IMAGE_NAME_TAG}" bash -c "env | grep --extended-regexp '^(HOME|PATH|USER)='" | tee --append "/tmp/env-$USER-$CONTAINER_NAME"
echo "Creating $CI_IMAGE_NAME_TAG container to run in"
DOCKER_BUILDKIT=1 docker build \
# Use buildx unconditionally
# Using buildx is required to properly load the correct driver, for use with registry caching. Neither build, nor BUILDKIT=1 currently do this properly
# shellcheck disable=SC2086
docker buildx build \
--file "${BASE_READ_ONLY_DIR}/ci/test_imagefile" \
--build-arg "CI_IMAGE_NAME_TAG=${CI_IMAGE_NAME_TAG}" \
--build-arg "FILE_ENV=${FILE_ENV}" \
--label="${CI_IMAGE_LABEL}" \
$DOCKER_BUILD_CACHE_ARG \
--tag="${CONTAINER_NAME}" \
"${BASE_READ_ONLY_DIR}"