From b9fc79f608fefccc2e6047854c3549bd09fc132b Mon Sep 17 00:00:00 2001 From: Michal Budzyn Date: Mon, 26 Feb 2024 20:45:01 +0100 Subject: [PATCH] multi-platform docker images --- .github/workflows/release.yml | 1 + .goreleaser.yaml | 29 +++++++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 022d407..975a1da 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -33,6 +33,7 @@ jobs: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} + - uses: docker/setup-qemu-action@v3 - uses: goreleaser/goreleaser-action@v5 # run goreleaser with: version: latest diff --git a/.goreleaser.yaml b/.goreleaser.yaml index a97db87..d1fbc5d 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -62,18 +62,43 @@ signs: # create a docker image # https://goreleaser.com/customization/docker +# https://goreleaser.com/cookbooks/multi-platform-docker-images/ dockers: - image_templates: - - "ghcr.io/grepplabs/reverse-http:{{ .Tag }}" - - "ghcr.io/grepplabs/reverse-http:latest" + - "ghcr.io/grepplabs/reverse-http:{{ .Tag }}-amd64" dockerfile: Dockerfile + use: buildx build_flag_templates: - "--pull" + - "--platform=linux/amd64" - "--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}}" + - image_templates: + - "ghcr.io/grepplabs/reverse-http:{{ .Tag }}-arm64" + dockerfile: Dockerfile + use: buildx + build_flag_templates: + - "--pull" + - "--platform=linux/arm64" + - "--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}}" + +# https://goreleaser.com/customization/docker_manifest/ +docker_manifests: +- name_template: 'ghcr.io/grepplabs/reverse-http:{{ .Tag }}' + image_templates: + - 'ghcr.io/grepplabs/reverse-http:{{ .Tag }}-amd64' + - 'ghcr.io/grepplabs/reverse-http:{{ .Tag }}-arm64' +- name_template: 'ghcr.io/grepplabs/reverse-http:latest' + image_templates: + - 'ghcr.io/grepplabs/reverse-http:{{ .Tag }}-amd64' + - 'ghcr.io/grepplabs/reverse-http:{{ .Tag }}-arm64' # signs our docker image # https://goreleaser.com/customization/docker_sign