Skip to content

Commit

Permalink
feat: create multi-arch container images with AMD64 and ARM64 (#38)
Browse files Browse the repository at this point in the history
* feat: create multi-arch container images with AMD64 and ARM64
* fix: use joschi/dive:latest-amd64 in CI
  • Loading branch information
joschi authored Nov 7, 2024
1 parent e46f931 commit 91d6909
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 6 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ jobs:
- name: Bootstrap environment
uses: ./.github/actions/bootstrap

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Tag release
run: |
git tag ${{ github.event.inputs.version }}
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/validations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ jobs:
- name: Bootstrap environment
uses: ./.github/actions/bootstrap

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build snapshot artifacts
run: make snapshot

Expand Down
36 changes: 32 additions & 4 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,44 @@ nfpms:
- deb

dockers:
- ids:
- id: docker-amd64
ids:
- dive
dockerfile: Dockerfile
use: buildx
goarch: amd64
image_templates:
- '{{ envOrDefault "REGISTRY" "docker.io" }}/joschi/dive:latest'
- '{{ envOrDefault "REGISTRY" "docker.io" }}/joschi/dive:{{ .Version }}'
- '{{ envOrDefault "REGISTRY" "docker.io" }}/joschi/dive:latest-amd64'
- '{{ envOrDefault "REGISTRY" "docker.io" }}/joschi/dive:{{ .Version }}-amd64'
build_flag_templates:
- "--build-arg=DOCKER_CLI_VERSION={{.Env.DOCKER_CLI_VERSION}}"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--label=org.opencontainers.image.source={{.GitURL}}"
- "--platform=linux/amd64"
- id: docker-arm64
ids:
- dive
use: buildx
goarch: arm64
image_templates:
- '{{ envOrDefault "REGISTRY" "docker.io" }}/joschi/dive:latest-arm64'
- '{{ envOrDefault "REGISTRY" "docker.io" }}/joschi/dive:{{ .Version }}-arm64'
build_flag_templates:
- "--build-arg=DOCKER_CLI_VERSION={{.Env.DOCKER_CLI_VERSION}}"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--label=org.opencontainers.image.source={{.GitURL}}"
- "--platform=linux/arm64/v8"
docker_manifests:
- name_template: '{{ envOrDefault "REGISTRY" "docker.io" }}/joschi/dive:latest'
image_templates:
- '{{ envOrDefault "REGISTRY" "docker.io" }}/joschi/dive:latest-amd64'
- '{{ envOrDefault "REGISTRY" "docker.io" }}/joschi/dive:latest-arm64'
- name_template: '{{ envOrDefault "REGISTRY" "docker.io" }}/joschi/dive:{{ .Version }}'
image_templates:
- '{{ envOrDefault "REGISTRY" "docker.io" }}/joschi/dive:{{ .Version }}-amd64'
- '{{ envOrDefault "REGISTRY" "docker.io" }}/joschi/dive:{{ .Version }}-arm64'
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ RUN wget -O- https://download.docker.com/linux/static/stable/$(uname -m)/docker-
COPY dive /usr/local/bin/

FROM scratch
COPY --from=base / /
COPY --from=base /usr/local/bin /usr/local/bin

ENTRYPOINT ["/usr/local/bin/dive"]
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ ci-test-docker-image:
--rm \
-t \
-v /var/run/docker.sock:/var/run/docker.sock \
'${PRODUCTION_REGISTRY}/joschi/dive:latest' \
'${PRODUCTION_REGISTRY}/joschi/dive:latest-amd64' \
'${TEST_IMAGE}' \
--ci

Expand Down

0 comments on commit 91d6909

Please sign in to comment.