From 79ca97c0a2fc8f4808077a3306cdd6847be400b6 Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Mon, 4 Mar 2024 13:00:00 +0100 Subject: [PATCH 1/7] fix: tagging manifest with latest --- entrypoint.sh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 2a9af5c..8e59589 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -113,14 +113,13 @@ if [ -n "$INPUT_PLATFORMS" ]; then DIGESTS="$DIGESTS -m $digest" done - TAGS="-t $IMAGE" - if [ -n "$IMAGE_LATEST" ]; then - TAGS="$TAGS -t $IMAGE_LATEST" - fi - - manifest_cmd="crane index append $TAGS $DIGESTS" + manifest_cmd="crane index append -t $IMAGE $DIGESTS" echo "Building manifest: $manifest_cmd" IMAGE_TAG_DIGEST=$(eval "$manifest_cmd") + + if [ -n "$IMAGE_LATEST" ]; then + crane tag "$IMAGE" latest + fi else # Build and push image for the default platform echo "⚒️ Building image $IMAGE" From 48663155860e2b862b975a90f3fff3fffcd3e17d Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Fri, 31 May 2024 00:23:53 +0200 Subject: [PATCH 2/7] feat: add dockerfile build arguments --- README.md | 13 +++++++++++++ entrypoint.sh | 11 ++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b140b47..79e347b 100644 --- a/README.md +++ b/README.md @@ -218,3 +218,16 @@ Example: `thetadev256/test-actions-helloworld2:main` Full reference to the built image with registry and tag. Example: `thetadev256/test-actions-helloworld2:main` + +## Dockerfile build arguments + +Action-Kaniko automatically sets build arguments to allow for different dockerfile actions +depending on the OS and architecture the image is build for. + +The supported arguments are: + +- `TARGETPLATFORM` (example: linux/amd64) +- `TARGETOS` (example: linux) +- `TARGETARCH` (example: amd64) +- `TARGETARCH_ALT` (alternative architecture name, x86_64 for amd64, otherwise the same as TARGETARCH) +- `TARGETVARIANT` (third docker platform parameter like ARM version) diff --git a/entrypoint.sh b/entrypoint.sh index 8e59589..7ddb396 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -96,7 +96,16 @@ if [ -n "$INPUT_PLATFORMS" ]; then DESTINATION="--no-push --tarPath /kaniko/build/${platformFn}.tar --destination $IMAGE" DIGEST="--image-name-tag-with-digest-file=/kaniko/build/${platformFn}_image-tag-digest" - runKaniko "${ARGS} --custom-platform=${platform} $DESTINATION $DIGEST" + targetos=$(echo "$platform" | cut -d/ -f1) + targetarch=$(echo "$platform" | cut -d/ -f2) + targetvariant=$(echo "$platform" | cut -d/ -f3) + + case "$targetarch" in + 'amd64') targetarchAlt="x86_64" ;; + *) targetarchAlt="$targetarch" ;; + esac + + runKaniko "${ARGS} --custom-platform=${platform} --build-arg TARGETPLATFORM='${platform}' --build-arg TARGETOS='${targetos}' --build-arg TARGETARCH='${targetarch}' --build-arg TARGETARCH_ALT='${targetarchAlt}' --build-arg TARGETVARIANT='${targetvariant}' $DESTINATION $DIGEST" echo "✅ $platform image built: $(head -n 1 "/kaniko/build/${platformFn}_image-tag-digest")" done From 67a2ae32b0d4d6c59f57447d29f4313a7b12c0cb Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Fri, 31 May 2024 00:56:57 +0200 Subject: [PATCH 3/7] fix: add support for other architectures --- entrypoint.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/entrypoint.sh b/entrypoint.sh index 7ddb396..9e5967c 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -102,6 +102,17 @@ if [ -n "$INPUT_PLATFORMS" ]; then case "$targetarch" in 'amd64') targetarchAlt="x86_64" ;; + 'arm64') targetarchAlt="aarch64" ;; + 'i386') targetarchAlt="i686" ;; + '386') targetarchAlt="i686" ;; + 'ppc64le') targetarchAlt="powerpc64le" ;; + 'arm') + case "$targetvariant" in + 'v5') targetarchAlt="armv5te" ;; + 'v7') targetarchAlt="armv7" ;; + *) targetarchAlt="arm" ;; + esac + ;; *) targetarchAlt="$targetarch" ;; esac From dbb8da86cf2d498dde8ec1b3be967ceda17a21ff Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Fri, 31 May 2024 12:59:54 +0200 Subject: [PATCH 4/7] chore: update kaniko to v1.23.0, update crane to v0.19.1 --- Dockerfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0a0b73b..7570645 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM gcr.io/kaniko-project/executor:v1.21.0-debug +FROM gcr.io/kaniko-project/executor:v1.23.0-debug SHELL ["/busybox/sh", "-c"] @@ -6,12 +6,12 @@ SHELL ["/busybox/sh", "-c"] RUN set -eux; \ case "$(arch)" in \ 'x86_64') \ - url='https://github.com/google/go-containerregistry/releases/download/v0.19.0/go-containerregistry_Linux_x86_64.tar.gz'; \ - sha256='daa629648e1d1d10fc8bde5e6ce4176cbc0cd48a32211b28c3fd806e0fa5f29b'; \ + url='https://github.com/google/go-containerregistry/releases/download/v0.19.1/go-containerregistry_Linux_x86_64.tar.gz'; \ + sha256='5f2b43c32a901adaaabaa78755d56cea71183954de7547cb4c4bc64b9ac6b2ff'; \ ;; \ 'aarch64') \ - url='https://github.com/google/go-containerregistry/releases/download/v0.19.0/go-containerregistry_Linux_arm64.tar.gz'; \ - sha256='d439957c1a9d6bc0870be921e25753a7fa67bf2b2691b77ce48a6fc25bc719a0'; \ + url='https://github.com/google/go-containerregistry/releases/download/v0.19.1/go-containerregistry_Linux_arm64.tar.gz'; \ + sha256='9118c29cdf2197441c4a934cf517df76c021ba12a70edc14ee9dc4dc08226680'; \ ;; \ *) echo >&2 "error: unsupported architecture '$arch' (likely packaging update needed)"; exit 1 ;; \ esac; \ From 4be1d51afa0b9c6af0a5cbedaf35a3660706db78 Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Sat, 22 Mar 2025 15:16:54 +0100 Subject: [PATCH 5/7] update action URL --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 79e347b..46d0ae1 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Viscreanu. ```yaml steps: - name: Build docker image - uses: https://code.thetadev.de/ThetaDev/action-kaniko@v1 + uses: https://code.thetadev.de/actions/kaniko@v1 with: image: thetadev256/test-actions-helloworld2 username: thetadev256 From 71f14860d84aedffad663b09a279837029f29f10 Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Sun, 20 Jul 2025 01:37:59 +0200 Subject: [PATCH 6/7] chore: update kaniko to v1.24.0 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 7570645..95e4cec 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM gcr.io/kaniko-project/executor:v1.23.0-debug +FROM gcr.io/kaniko-project/executor:v1.24.0-debug SHELL ["/busybox/sh", "-c"] From e528090290ab788af49c4f0ba07488724bc94a8a Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Sun, 20 Jul 2025 01:46:38 +0200 Subject: [PATCH 7/7] chore: update crane to v0.20.6 --- Dockerfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 95e4cec..50c394a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,12 +6,12 @@ SHELL ["/busybox/sh", "-c"] RUN set -eux; \ case "$(arch)" in \ 'x86_64') \ - url='https://github.com/google/go-containerregistry/releases/download/v0.19.1/go-containerregistry_Linux_x86_64.tar.gz'; \ - sha256='5f2b43c32a901adaaabaa78755d56cea71183954de7547cb4c4bc64b9ac6b2ff'; \ + url='https://github.com/google/go-containerregistry/releases/download/v0.20.6/go-containerregistry_Linux_x86_64.tar.gz'; \ + sha256='c1d593d01551f2c9a3df5ca0a0be4385a839bd9b86d4a76e18d7b17d16559127'; \ ;; \ 'aarch64') \ - url='https://github.com/google/go-containerregistry/releases/download/v0.19.1/go-containerregistry_Linux_arm64.tar.gz'; \ - sha256='9118c29cdf2197441c4a934cf517df76c021ba12a70edc14ee9dc4dc08226680'; \ + url='https://github.com/google/go-containerregistry/releases/download/v0.20.6/go-containerregistry_Linux_arm64.tar.gz'; \ + sha256='fc0515857bc38e4ddd2d37a5ab03fb5959449c7b2d4ad759bcc1174ac0cad91b'; \ ;; \ *) echo >&2 "error: unsupported architecture '$arch' (likely packaging update needed)"; exit 1 ;; \ esac; \