Skip to content

Commit c8bce62

Browse files
authored
Fix for 196: Multi-architecture image (#204)
* 196: qemu * 196: multi-arch; see also https://blog.devgenius.io/goreleaser-build-multi-arch-docker-images-8dd9a7903675
1 parent 065fad0 commit c8bce62

File tree

2 files changed

+47
-4
lines changed

2 files changed

+47
-4
lines changed

.github/workflows/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ jobs:
3838
with:
3939
fetch-depth: 0 # https://github.com/goreleaser/goreleaser-action/issues/56
4040

41+
- uses: docker/setup-qemu-action@v2
42+
- uses: docker/setup-buildx-action@v2
43+
4144
- name: goreleaser
4245
run: |
4346
echo "${{ github.token }}" | docker login https://ghcr.io -u ${GITHUB_ACTOR} --password-stdin

.goreleaser.yml

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,23 +32,63 @@ archives:
3232

3333
dockers:
3434
- image_templates:
35-
- 'ghcr.io/{{.Env.GIT_OWNER}}/kubeconform:latest'
36-
- 'ghcr.io/{{.Env.GIT_OWNER}}/kubeconform:{{ .Tag }}'
3735
- 'ghcr.io/{{.Env.GIT_OWNER}}/kubeconform:{{ .Tag }}-amd64'
36+
- 'ghcr.io/{{.Env.GIT_OWNER}}/kubeconform:latest-amd64'
3837
dockerfile: Dockerfile
38+
use: buildx
3939
build_flag_templates:
40+
- "--pull"
4041
- "--platform=linux/amd64"
4142
goos: linux
4243
goarch: amd64
4344
- image_templates:
44-
- 'ghcr.io/{{.Env.GIT_OWNER}}/kubeconform:latest-alpine'
45-
- 'ghcr.io/{{.Env.GIT_OWNER}}/kubeconform:{{ .Tag }}-alpine'
45+
- 'ghcr.io/{{.Env.GIT_OWNER}}/kubeconform:{{ .Tag }}-arm64'
46+
- 'ghcr.io/{{.Env.GIT_OWNER}}/kubeconform:latest-arm64'
47+
dockerfile: Dockerfile
48+
use: buildx
49+
build_flag_templates:
50+
- "--pull"
51+
- "--platform=linux/arm64"
52+
goos: linux
53+
goarch: arm64
54+
- image_templates:
4655
- 'ghcr.io/{{.Env.GIT_OWNER}}/kubeconform:{{ .Tag }}-amd64-alpine'
56+
- 'ghcr.io/{{.Env.GIT_OWNER}}/kubeconform:latest-amd64-alpine'
4757
dockerfile: Dockerfile-alpine
58+
use: buildx
4859
build_flag_templates:
60+
- "--pull"
4961
- "--platform=linux/amd64"
5062
goos: linux
5163
goarch: amd64
64+
- image_templates:
65+
- 'ghcr.io/{{.Env.GIT_OWNER}}/kubeconform:{{ .Tag }}-arm64-alpine'
66+
- 'ghcr.io/{{.Env.GIT_OWNER}}/kubeconform:latest-arm64-alpine'
67+
dockerfile: Dockerfile-alpine
68+
use: buildx
69+
build_flag_templates:
70+
- "--pull"
71+
- "--platform=linux/arm64"
72+
goos: linux
73+
goarch: arm64
74+
75+
docker_manifests:
76+
- name_template: 'ghcr.io/{{.Env.GIT_OWNER}}/kubeconform:{{ .Tag }}'
77+
image_templates:
78+
- 'ghcr.io/{{.Env.GIT_OWNER}}/kubeconform:{{ .Tag }}-amd64'
79+
- 'ghcr.io/{{.Env.GIT_OWNER}}/kubeconform:{{ .Tag }}-arm64'
80+
- name_template: 'ghcr.io/{{.Env.GIT_OWNER}}/kubeconform:latest'
81+
image_templates:
82+
- 'ghcr.io/{{.Env.GIT_OWNER}}/kubeconform:latest-amd64'
83+
- 'ghcr.io/{{.Env.GIT_OWNER}}/kubeconform:latest-arm64'
84+
- name_template: 'ghcr.io/{{.Env.GIT_OWNER}}/kubeconform:latest-alpine'
85+
image_templates:
86+
- 'ghcr.io/{{.Env.GIT_OWNER}}/kubeconform:latest-amd64-alpine'
87+
- 'ghcr.io/{{.Env.GIT_OWNER}}/kubeconform:latest-arm64-alpine'
88+
- name_template: 'ghcr.io/{{.Env.GIT_OWNER}}/kubeconform:{{ .Tag }}-alpine'
89+
image_templates:
90+
- 'ghcr.io/{{.Env.GIT_OWNER}}/kubeconform:{{ .Tag }}-amd64-alpine'
91+
- 'ghcr.io/{{.Env.GIT_OWNER}}/kubeconform:{{ .Tag }}-arm64-alpine'
5292

5393
checksum:
5494
name_template: 'CHECKSUMS'

0 commit comments

Comments
 (0)