Skip to content

Commit

Permalink
refactor(docker): optimize goreleaser config for improved multi-arch …
Browse files Browse the repository at this point in the history
…builds
  • Loading branch information
yarlson committed Jan 25, 2025
1 parent 4ea7f17 commit c96ad3d
Showing 1 changed file with 18 additions and 30 deletions.
48 changes: 18 additions & 30 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ version: 2
project_name: zero

builds:
- id: zero
main: ./main.go
- env:
- CGO_ENABLED=0
binary: zero
goos:
- linux
- darwin
Expand All @@ -14,8 +15,6 @@ builds:
- arm64
ldflags:
- -s -w -X main.version={{.Version}}
env:
- CGO_ENABLED=0

archives:
- id: release_archive
Expand All @@ -25,44 +24,33 @@ archives:
- README.md

dockers:
- id: zero-amd64
goos: linux
goarch: amd64
image_templates:
- image_templates:
- "yarlson/zero:{{ .Version }}-amd64"
- "yarlson/zero:latest-amd64"
use: buildx
dockerfile: Dockerfile
use: docker
build_flag_templates:
- "--platform=linux/amd64"

- id: zero-arm64
goos: linux

- image_templates:
- "yarlson/zero:{{ .Version }}-arm64v8"
- "yarlson/zero:latest-arm64v8"
use: buildx
goarch: arm64
image_templates:
- "yarlson/zero:{{ .Version }}-arm64"
- "yarlson/zero:latest-arm64"
dockerfile: Dockerfile
use: docker
build_flag_templates:
- "--platform=linux/arm64"
- "--platform=linux/arm64/v8"

docker_manifests:
- id: zero-version
name_template: yarlson/zero:{{ .Version }}
- name_template: "yarlson/zero:{{ .Version }}"
image_templates:
- yarlson/zero:{{ .Version }}-amd64
- yarlson/zero:{{ .Version }}-arm64
use: docker
skip_push: auto

- id: zero-latest
name_template: yarlson/zero:latest
- "yarlson/zero:{{ .Version }}-amd64"
- "yarlson/zero:{{ .Version }}-arm64v8"

- name_template: "yarlson/zero:latest"
image_templates:
- yarlson/zero:latest-amd64
- yarlson/zero:latest-arm64
use: docker
skip_push: auto
- "yarlson/zero:latest-amd64"
- "yarlson/zero:latest-arm64v8"

release:
github:
Expand Down

0 comments on commit c96ad3d

Please sign in to comment.