Skip to content

Commit afc369e

Browse files
committed
use matrix strategy to build for each platform
1 parent 52ec836 commit afc369e

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

.github/workflows/build.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,45 @@ on:
44
release:
55
types: [published]
66
workflow_dispatch:
7-
branches: [ "master", "main" ]
7+
branches: ["master", "main"]
88

99
jobs:
10-
push_to_registry:
11-
name: Push Docker image to Docker Hub
10+
11+
build-and-push:
12+
name: Build and Push Docker Image
1213
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
platform: [linux/amd64, linux/arm64]
17+
1318
steps:
1419
- name: Checkout
1520
uses: actions/checkout@v4
21+
1622
- name: Set up QEMU
1723
uses: docker/setup-qemu-action@v3
24+
1825
- name: Set up Docker Buildx
1926
uses: docker/setup-buildx-action@v3
27+
2028
- name: Login to Docker Hub
2129
uses: docker/login-action@v3
2230
with:
2331
username: ${{ secrets.DOCKERHUB_USERNAME }}
2432
password: ${{ secrets.DOCKERHUB_TOKEN }}
33+
2534
- name: Extract metadata (tags, labels) for Docker
2635
id: meta
2736
uses: docker/metadata-action@v5
2837
with:
2938
images: middlewareeng/middleware
30-
39+
3140
- name: Build and push Docker image
3241
uses: docker/build-push-action@v5
3342
with:
3443
context: .
3544
file: ./Dockerfile
36-
platforms: linux/amd64,linux/arm64
45+
platforms: ${{ matrix.platform }}
3746
push: true
3847
tags: ${{ steps.meta.outputs.tags }}
3948
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)