File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Build and Push Multi-Arch Docker Image
2+
3+ on :
4+ push :
5+ branches : [ main ]
6+ pull_request :
7+ branches : [ main ]
8+ workflow_dispatch : # Allows manual triggering
9+
10+ env :
11+ IMAGE_NAME : coredump
12+
13+ jobs :
14+ build-and-push :
15+ runs-on : ubuntu-latest
16+ steps :
17+ - name : Checkout code
18+ uses : actions/checkout@v4
19+
20+ - name : Set up QEMU
21+ uses : docker/setup-qemu-action@v3
22+ with :
23+ platforms : arm64,amd64
24+
25+ - name : Set up Docker Buildx
26+ uses : docker/setup-buildx-action@v3
27+ with :
28+ use : true
29+
30+ - name : Login to container registry
31+ if : github.event_name != 'pull_request'
32+ uses : docker/login-action@v3
33+ with :
34+ # Replace with your registry details
35+ registry : ghcr.io
36+ username : ${{ github.actor }}
37+ password : ${{ secrets.GITHUB_TOKEN }}
38+
39+ - name : Extract metadata for Docker
40+ id : meta
41+ uses : docker/metadata-action@v5
42+ with :
43+ images : ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
44+ tags : |
45+ type=ref,event=branch
46+ type=ref,event=pr
47+ type=semver,pattern={{version}}
48+ type=sha,format=short
49+
50+ - name : Build and push
51+ uses : docker/build-push-action@v5
52+ with :
53+ context : .
54+ platforms : linux/amd64,linux/arm64
55+ push : ${{ github.event_name != 'pull_request' }}
56+ tags : ${{ steps.meta.outputs.tags }}
57+ labels : ${{ steps.meta.outputs.labels }}
58+ cache-from : type=gha
59+ cache-to : type=gha,mode=max
You can’t perform that action at this time.
0 commit comments