Use a multistage image to remove all redundancies on Dockerfiles (#2547)

As all Kaniko variants should be upgraded at once, all following the same specifications, it is easier for maintainers to bump Go or other image dependencies in a single place.

On top of that, there were an issue building `ppc64le` images because of a semantic error on the if condition that checks the arch used.

Signed-off-by: Ferran Vidal <ferran.vidal.p@gmail.com>
This commit is contained in:
Ferran Vidal
2023-06-05 09:20:40 -07:00
committed by GitHub
parent f4dae004ef
commit 507fe00b42
7 changed files with 72 additions and 254 deletions
+6 -5
View File
@@ -32,28 +32,28 @@ jobs:
include:
- image: executor
dockerfile: ./deploy/Dockerfile
target: kaniko-executor
platforms: linux/amd64,linux/arm64,linux/s390x,linux/ppc64le
image-name: gcr.io/kaniko-project/executor
tag: ${{ github.sha }}
release-tag: latest
- image: executor-debug
dockerfile: ./deploy/Dockerfile_debug
target: kaniko-debug
platforms: linux/amd64,linux/arm64,linux/s390x
image-name: gcr.io/kaniko-project/executor
tag: ${{ github.sha }}-debug
release-tag: debug
- image: executor-slim
dockerfile: ./deploy/Dockerfile_slim
target: kaniko-slim
platforms: linux/amd64,linux/arm64,linux/s390x,linux/ppc64le
image-name: gcr.io/kaniko-project/executor
tag: ${{ github.sha }}-slim
release-tag: slim
- image: warmer
dockerfile: ./deploy/Dockerfile_warmer
target: kaniko-warmer
platforms: linux/amd64,linux/arm64,linux/s390x,linux/ppc64le
image-name: gcr.io/kaniko-project/warmer
tag: ${{ github.sha }}
@@ -91,7 +91,7 @@ jobs:
id: build-and-push
with:
context: .
file: ${{ matrix.dockerfile }}
file: ./deploy/Dockerfile
platforms: ${{ steps.platforms.outputs.platforms }}
push: ${{ github.event_name != 'pull_request' }} # Only push if not a PR.
tags: ${{ matrix.image-name }}:${{ matrix.tag }}
@@ -99,6 +99,7 @@ jobs:
# https://github.com/docker/build-push-action/blob/master/docs/advanced/cache.md#github-cache
cache-from: type=gha
cache-to: type=gha,mode=max
target: ${{ matrix.target }}
# Sign images if not a PR.
- if: github.event_name != 'pull_request'