From 7377cac6fe49b788181fe72e1e8fb9238a3759a2 Mon Sep 17 00:00:00 2001 From: Mathias Gebbe Date: Mon, 17 Jun 2024 00:04:29 +0200 Subject: [PATCH] ci: gorleaser multiarch docker build https://goreleaser.com/cookbooks/multi-platform-docker-images/#creating-multi-platform-docker-images-with-goreleaser --- .github/workflows/release.yml | 6 ++++++ .goreleaser.yml | 24 +++++++++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 00e1d5c..3f3dcb9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,6 +13,12 @@ jobs: - name: Checkout code uses: actions/checkout@v4 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Docker Login uses: docker/login-action@v3.2.0 with: diff --git a/.goreleaser.yml b/.goreleaser.yml index ee2f853..e27209f 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -35,6 +35,7 @@ release: dockers: - id: linux-amd64 + use: buildx goos: linux goarch: amd64 dockerfile: Dockerfile-goreleaser @@ -47,5 +48,26 @@ dockers: - "--label=org.opencontainers.image.source={{ .GitURL }}" - "--platform=linux/amd64" image_templates: - - "ghcr.io/matzegebbe/web-jwks-validator:v{{ .Version }}" + - "ghcr.io/matzegebbe/web-jwks-validator:v{{ .Version }}-amd64" + - id: linux-arm64 + use: buildx + goos: linux + goarch: arm64 + dockerfile: Dockerfile-goreleaser + build_flag_templates: + - "--pull" + - "--label=org.opencontainers.image.created={{ .Date }}" + - "--label=org.opencontainers.image.name={{ .ProjectName }}" + - "--label=org.opencontainers.image.revision={{ .FullCommit }}" + - "--label=org.opencontainers.image.version={{ .Version }}" + - "--label=org.opencontainers.image.source={{ .GitURL }}" + - "--platform=linux/arm64" + image_templates: + - "ghcr.io/matzegebbe/web-jwks-validator:v{{ .Version }}-arm64" + +docker_manifests: +- name_template: "ghcr.io/matzegebbe/web-jwks-validator:v{{ .Version }}" + image_templates: + - "ghcr.io/matzegebbe/web-jwks-validator:v{{ .Version }}-amd64" + - "ghcr.io/matzegebbe/web-jwks-validator:v{{ .Version }}-arm64"