Skip to content

Commit 5a2f6ff

Browse files
committed
add docker multiarch build
Signed-off-by: Shamil Ganiev <ganiev@pm.me>
1 parent 7843ec2 commit 5a2f6ff

File tree

4 files changed

+46
-17
lines changed

4 files changed

+46
-17
lines changed

.github/workflows/ci.yaml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ jobs:
9090
- name: Checkout
9191
uses: actions/checkout@v4
9292

93+
- name: Set up QEMU
94+
uses: docker/setup-qemu-action@v3
95+
96+
- name: Set up Docker Buildx
97+
uses: docker/setup-buildx-action@v3
98+
9399
- name: Login to Docker
94100
uses: docker/login-action@v3
95101
if: env.REGISTRY_USERNAME != ''
@@ -98,17 +104,14 @@ jobs:
98104
username: ${{ secrets.REGISTRY_USERNAME }}
99105
password: ${{ secrets.REGISTRY_PASSWORD }}
100106

101-
- name: Build 'dev' Docker image
102-
if: "!contains(github.ref, 'refs/heads/master')"
103-
run: make docker
104-
env:
105-
DOCKER_TAG: ${{ github.sha }}
106-
107-
- name: Build and push 'edge' Docker image
107+
- name: Build and push Docker image
108108
if: env.REGISTRY_USERNAME != '' && contains(github.ref, 'refs/heads/master')
109-
run: make docker push
110-
env:
111-
DOCKER_TAG: edge
109+
uses: docker/build-push-action@v5
110+
with:
111+
outputs: "type=registry,push=true"
112+
platforms: linux/amd64,linux/arm64
113+
push: true
114+
tags: quay.io/${{ env.REPO_OWNER }}/terraform-docs:edge
112115

113116
publish:
114117
runs-on: ubuntu-latest

.github/workflows/prerelease.yaml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ jobs:
5454
id: vars
5555
run: echo ::set-output name=tag::${GITHUB_REF:11} # tag name without leading 'v'
5656

57+
- name: Set up QEMU
58+
uses: docker/setup-qemu-action@v3
59+
60+
- name: Set up Docker Buildx
61+
uses: docker/setup-buildx-action@v3
62+
5763
- name: Login to Docker
5864
uses: docker/login-action@v3
5965
if: env.REGISTRY_USERNAME != ''
@@ -63,8 +69,9 @@ jobs:
6369
password: ${{ secrets.REGISTRY_PASSWORD }}
6470

6571
- name: Build and push Docker image
66-
run: make docker push
67-
env:
68-
DOCKER_TAG: ${{ steps.vars.outputs.tag }}
69-
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
70-
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
72+
uses: docker/build-push-action@v5
73+
with:
74+
outputs: "type=registry,push=true"
75+
platforms: linux/amd64,linux/arm64
76+
push: true
77+
tags: quay.io/${{ env.REPO_OWNER }}/terraform-docs:${{ steps.vars.outputs.tag }}

.github/workflows/release.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ jobs:
2525
with:
2626
go-version: ${{ env.GO_VERSION }}
2727

28+
- name: Set up QEMU
29+
uses: docker/setup-qemu-action@v3
30+
31+
- name: Set up Docker Buildx
32+
uses: docker/setup-buildx-action@v3
33+
2834
- name: Login to Docker
2935
uses: docker/login-action@v3
3036
if: env.REGISTRY_USERNAME != ''

.goreleaser.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,21 @@ changelog:
4848
dockers:
4949
- dockerfile: scripts/release/Dockerfile
5050
image_templates:
51-
- "quay.io/terraform-docs/terraform-docs:latest"
52-
- "quay.io/terraform-docs/terraform-docs:{{ .RawVersion }}"
51+
- "quay.io/terraform-docs/terraform-docs:latest-amd64"
52+
- "quay.io/terraform-docs/terraform-docs:{{ .RawVersion }}-amd64"
53+
use: buildx
54+
build_flag_templates:
55+
- "--pull"
56+
- "--platform=linux/amd64"
57+
- dockerfile: scripts/release/Dockerfile
58+
image_templates:
59+
- "quay.io/terraform-docs/terraform-docs:latest-arm64"
60+
- "quay.io/terraform-docs/terraform-docs:{{ .RawVersion }}-arm64"
61+
use: buildx
62+
build_flag_templates:
63+
- "--pull"
64+
- "--platform=linux/arm64"
65+
goarch: arm64
5366

5467
brews:
5568
- tap:

0 commit comments

Comments
 (0)