From 6df47066bcbb0a89c27303b65d95a4edd0251467 Mon Sep 17 00:00:00 2001 From: nikhilsbhat Date: Sun, 22 Dec 2024 23:17:55 +0530 Subject: [PATCH] Update goreleaser to support multiarch docker images --- .goreleaser.yml | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index f925e70..ad252f8 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,5 +1,6 @@ # This is an example .goreleaser.yml file with some sane defaults. # Make sure to check the documentation at http://goreleaser.com +version: 2 before: hooks: # You may remove this if you don't use go modules. @@ -31,16 +32,40 @@ builds: binary: '{{ .ProjectName }}' dockers: - - goos: linux - goarch: amd64 + - use: buildx ids: - gocd-cli + dockerfile: Dockerfile skip_push: false image_templates: - "ghcr.io/nikhilsbhat/gocd-cli:latest" - - "ghcr.io/nikhilsbhat/gocd-cli:{{ .Tag }}" - "ghcr.io/nikhilsbhat/gocd-cli:{{ .Tag }}-{{ .Env.GOVERSION }}" + - use: buildx + ids: + - gocd-cli + dockerfile: Dockerfile + skip_push: false + image_templates: + - "ghcr.io/nikhilsbhat/gocd-cli:{{ .Tag }}-amd64" + build_flag_templates: + - "--pull" + - "--platform=linux/amd64" + - use: buildx + ids: + - gocd-cli dockerfile: Dockerfile + skip_push: false + image_templates: + - "ghcr.io/nikhilsbhat/gocd-cli:{{ .Tag }}-arm64" + build_flag_templates: + - "--pull" + - "--platform=linux/arm64" + +docker_manifests: + - name_template: "ghcr.io/nikhilsbhat/gocd-cli:{{ .Tag }}" + image_templates: + - "ghcr.io/nikhilsbhat/gocd-cli:{{ .Tag }}-amd64" + - "ghcr.io/nikhilsbhat/gocd-cli:{{ .Tag }}-arm64" archives: - format: 'tar.gz'