Skip to content

Commit e61659b

Browse files
committed
feat: add arch image tag matrix to az_acr_push
1 parent 3edef1a commit e61659b

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

.github/workflows/az_acr_push.yml

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,48 @@ on:
66

77
jobs:
88
az-acr-push:
9-
name: "Azure: Docker Container Build & Push"
9+
name: "Azure: ACR Build & Push"
1010
runs-on: ubuntu-latest
1111
environment: dev
1212
env:
1313
DOCKERFILE: ${{ vars.DOCKERFILE || 'Dockerfile' }}
14-
AZURE_IMAGE_TAG: latest
1514
AZURE_CONTAINER_REGISTRY: ${{ secrets.AZURE_CONTAINER_REGISTRY }}
1615
ACR_LOGIN_USERNAME: ${{ secrets.ACR_LOGIN_USERNAME }}
1716
ACR_LOGIN_PASSWORD: ${{ secrets.ACR_LOGIN_PASSWORD }}
17+
strategy:
18+
matrix:
19+
platform: [amd64, arm64]
1820
steps:
1921
- name: Checkout repository
2022
uses: actions/checkout@v4
21-
23+
- name: Set up Docker Buildx
24+
uses: docker/setup-buildx-action@v3
2225
- name: Log into registry
2326
uses: docker/login-action@v3
2427
with:
2528
registry: "${{ env.AZURE_CONTAINER_REGISTRY }}"
2629
username: "${{ env.ACR_LOGIN_USERNAME }}"
2730
password: "${{ env.ACR_LOGIN_PASSWORD }}"
2831

29-
- name: Build & Push - Static Image Tag
32+
- name: Build & Push
33+
uses: docker/build-push-action@v5
34+
with:
35+
cache-from: type=gha
36+
cache-to: type=gha,mode=max
37+
file: ${{ env.DOCKERFILE }}
38+
tags: ${{ env.AZURE_CONTAINER_REGISTRY }}/${{ github.event.repository.name }}:${{ matrix.platform}}
39+
push: true
40+
build-args: |
41+
platform=linux/${{ matrix.platform}}
42+
43+
- name: Build & Push - Replace branch
44+
if: ${{ github.ref != github.repository.default_branch }}
3045
uses: docker/build-push-action@v5
3146
with:
47+
cache-from: type=gha
48+
cache-to: type=gha,mode=max
3249
file: ${{ env.DOCKERFILE }}
33-
tags: ${{ env.AZURE_CONTAINER_REGISTRY }}/${{ github.event.repository.name }}:${{ env.AZURE_IMAGE_TAG }}
50+
tags: ${{ env.AZURE_CONTAINER_REGISTRY }}/${{ github.event.repository.name }}:${{ matrix.platform}}-${{ github.ref_name }}
3451
push: true
3552
build-args: |
36-
platform=linux/amd64
53+
platform=linux/${{ matrix.platform}}

0 commit comments

Comments
 (0)