From 5bc33a8f1c802f2d9aff4f9b0b9233a9a794f94f Mon Sep 17 00:00:00 2001 From: Juan Eugenio Abadie Date: Thu, 19 Oct 2023 08:16:12 +0200 Subject: [PATCH 1/2] Allow overriding DOCKER_BUILDKIT env var --- docker-build.sh | 2 +- entrypoint.sh | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/docker-build.sh b/docker-build.sh index 7455839..a6c001d 100755 --- a/docker-build.sh +++ b/docker-build.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash -export DOCKER_BUILDKIT=0 set -e +export DOCKER_BUILDKIT=${DOCKER_BUILDKIT:-0} # helper functions _has_value() { diff --git a/entrypoint.sh b/entrypoint.sh index 3009115..c8bf59c 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,6 +1,5 @@ #!/usr/bin/env bash -export DOCKER_BUILDKIT=0 set -e _build_image() { From 4a7761aab58ca0a3c7ce47824addbda299667bb8 Mon Sep 17 00:00:00 2001 From: Juan Eugenio Abadie Date: Thu, 19 Oct 2023 08:59:02 +0200 Subject: [PATCH 2/2] Update readme --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index 060f3e1..65209be 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,22 @@ Built-in support for the most known registries: - GitHub's (old and new registry) - Google Cloud's +## :exclamation: New behavior if you force `DOCKER_BUILDKIT=1` + +> It only affects multi-stage builds + +This action relies on old builder output where we could take the hash of each intermediate layer during build and tag it as an image. +When new builder is enabled (`DOCKER_BUILDKIT=1`), this action is not able to push the layers of intermediate stages as it can NOT parse the builder output. +As a workaround, the action now forces `DOCKER_BUILDKIT=0` by default, but if your workflow relies on the new builder, at the temporary price of not using caches for all the stages, you can enable `DOCKER_BUILDKIT` like this in your job step: + + - name: Build with DOCKER_BUILDKIT enabled + env: + DOCKER_BUILDKIT: 1 + uses: whoan/docker-build-with-cache-action@issue-139 + ... + +For plans to be able to cache all stages with `DOCKER_BUILDKIT=1`, see #138. + ## Inputs ### Required