diff --git a/.github/workflows/goreleaser-check.yml b/.github/workflows/goreleaser-check.yml index dd28d0c..e51858a 100644 --- a/.github/workflows/goreleaser-check.yml +++ b/.github/workflows/goreleaser-check.yml @@ -41,3 +41,11 @@ jobs: with: version: v2.15.2 args: release --snapshot --clean + + - name: Check snapshot images + run: | + for arch in amd64 arm64; do + image="publiccodeyml/libpubliccode:latest-${arch}" + test "$(docker image inspect --format '{{.Architecture}}' "$image")" = "$arch" + docker run --rm --platform "linux/${arch}" "$image" --help + done diff --git a/.goreleaser.yml b/.goreleaser.yml index fdf360c..6fca967 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -56,40 +56,40 @@ changelog: - '^chore' - '^test' - '^Merge' -dockers: - - - use: buildx - goos: linux - goarch: amd64 - ids: - - publiccode-parser +dockers_v2: + - id: publiccode-parser + ids: [publiccode-parser] dockerfile: Dockerfile.goreleaser - image_templates: - - "publiccodeyml/libpubliccode:{{ .Tag }}-amd64" - build_flag_templates: - - "--pull" - - "--platform=linux/amd64" - - "--label=org.opencontainers.image.source=https://github.com/publiccodeyml/libpubliccode" - - - use: buildx - goos: linux - goarch: arm64 - ids: - - publiccode-parser - dockerfile: Dockerfile.goreleaser - image_templates: - - "publiccodeyml/libpubliccode:{{ .Tag }}-arm64" - build_flag_templates: - - "--pull" - - "--platform=linux/arm64" - - "--label=org.opencontainers.image.source=https://github.com/publiccodeyml/libpubliccode" + images: [publiccodeyml/libpubliccode] + tags: + - "{{ .Tag }}" + - latest + platforms: + - linux/amd64 + - linux/arm64 + flags: ["--pull"] + labels: + org.opencontainers.image.source: https://github.com/publiccodeyml/libpubliccode -docker_manifests: - - name_template: "publiccodeyml/libpubliccode:latest" - image_templates: - - "publiccodeyml/libpubliccode:{{ .Tag }}-amd64" - - "publiccodeyml/libpubliccode:{{ .Tag }}-arm64" - - name_template: "publiccodeyml/libpubliccode:{{ .Tag }}" - image_templates: - - "publiccodeyml/libpubliccode:{{ .Tag }}-amd64" - - "publiccodeyml/libpubliccode:{{ .Tag }}-arm64" + # Keep the architecture tags used by existing consumers. + # Snapshots already add architecture suffixes to the tags above. + - id: publiccode-parser-amd64 + ids: [publiccode-parser] + dockerfile: Dockerfile.goreleaser + images: [publiccodeyml/libpubliccode] + tags: ["{{ .Tag }}-amd64"] + platforms: [linux/amd64] + disable: "{{ .IsSnapshot }}" + flags: ["--pull"] + labels: + org.opencontainers.image.source: https://github.com/publiccodeyml/libpubliccode + - id: publiccode-parser-arm64 + ids: [publiccode-parser] + dockerfile: Dockerfile.goreleaser + images: [publiccodeyml/libpubliccode] + tags: ["{{ .Tag }}-arm64"] + platforms: [linux/arm64] + disable: "{{ .IsSnapshot }}" + flags: ["--pull"] + labels: + org.opencontainers.image.source: https://github.com/publiccodeyml/libpubliccode diff --git a/Dockerfile.goreleaser b/Dockerfile.goreleaser index 5d31b94..5d20492 100644 --- a/Dockerfile.goreleaser +++ b/Dockerfile.goreleaser @@ -4,7 +4,8 @@ # FROM alpine:3.24@sha256:be2656061b536c1883c4034790e21d0a09c5aaaf51968b89368a3c0371ea2c9a -COPY publiccode-parser /usr/local/bin/publiccode-parser +ARG TARGETPLATFORM +COPY ${TARGETPLATFORM}/publiccode-parser /usr/local/bin/publiccode-parser # git and openssh-client are needed by CircleCI when using # publiccode-parser-orb, which uses this image.