Skip to content

Commit 80fb3ef

Browse files
authored
Merge pull request mikkeloscar#68 from celonis/build-and-push-arm64-images
2 parents 06bc039 + 38bc384 commit 80fb3ef

File tree

2 files changed

+48
-8
lines changed

2 files changed

+48
-8
lines changed

.github/workflows/ci.yaml

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,42 @@ jobs:
1919
make test
2020
make
2121
make build.docker
22+
- run: |
23+
make test
24+
make build.linux.amd64
25+
make build.linux.arm64
2226
- run: goveralls -coverprofile=profile.cov -service=github
2327
env:
2428
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25-
- name: Push the latest Docker image
26-
run: |
27-
echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
28-
VERSION=latest make build.push
29+
- name: Set up QEMU for multi-arch
30+
uses: docker/setup-qemu-action@v2
31+
32+
- name: Set up Docker Buildx
33+
uses: docker/setup-buildx-action@v2
34+
35+
- name: Log in to DockerHub
36+
uses: docker/login-action@v2
37+
with:
38+
username: ${{ secrets.DOCKERHUB_USERNAME }}
39+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
40+
41+
- name: Build & push multi-arch image (latest)
2942
if: github.ref == 'refs/heads/master'
30-
- name: Push the release Docker image
31-
run: |
32-
echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
33-
VERSION=${{ github.ref_name }} make build.push
43+
uses: docker/build-push-action@v3
44+
with:
45+
context: .
46+
file: Dockerfile
47+
platforms: linux/amd64,linux/arm64
48+
push: true
49+
tags: mikkeloscar/pdb-controller:latest
50+
51+
- name: Build & push multi-arch image (release)
3452
if: startsWith(github.ref, 'refs/tags/')
53+
uses: docker/build-push-action@v3
54+
with:
55+
context: .
56+
file: Dockerfile
57+
platforms: linux/amd64,linux/arm64
58+
push: true
59+
tags: |
60+
mikkeloscar/pdb-controller:${{ github.ref_name }}

Makefile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,19 @@ build/osx/$(BINARY): $(SOURCES)
4848
build.docker: build.linux
4949
docker build --rm -t "$(IMAGE):$(TAG)" -f $(DOCKERFILE) --build-arg TARGETARCH= .
5050

51+
build.docker.multi: build.linux.amd64 build.linux.arm64
52+
docker buildx build \
53+
--platform linux/amd64,linux/arm64 \
54+
--load \
55+
-t "$(IMAGE):$(TAG)" \
56+
-f $(DOCKERFILE) .
57+
5158
build.push: build.docker
5259
docker push "$(IMAGE):$(TAG)"
60+
61+
build.push.multi: build.linux.amd64 build.linux.arm64
62+
docker buildx build \
63+
--platform linux/amd64,linux/arm64 \
64+
--push \
65+
-t "$(IMAGE):$(TAG)" \
66+
-f $(DOCKERFILE) .

0 commit comments

Comments
 (0)