Skip to content

Commit 7064466

Browse files
committed
build in parallel and use native arm builder
1 parent a69e510 commit 7064466

3 files changed

Lines changed: 50 additions & 61 deletions

File tree

.github/workflows/docker-build.yml

Lines changed: 12 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,28 @@
1-
name: Docker Build
1+
name: Build and Publish Multi-Platform Docker Image
22

33
on:
44
push:
55
branches: ["main"]
66
tags: ["*"]
77

88
jobs:
9-
build:
10-
strategy:
11-
matrix:
12-
include:
13-
- platform: linux/amd64
14-
runs-on: ubuntu-latest
15-
- platform: linux/arm64
16-
runs-on: ubuntu-latest-arm64
17-
18-
runs-on: ${{ matrix.runs-on }}
19-
permissions:
20-
contents: read
21-
packages: write
22-
23-
steps:
24-
- name: Checkout repository
25-
uses: actions/checkout@v4
26-
27-
- name: Prepare repository name in lowercase
28-
id: repo
29-
run: echo "name=$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT
30-
- name: Set up QEMU
31-
uses: docker/setup-qemu-action@v3
9+
build-amd64:
10+
uses: ./.github/workflows/publish-amd64.yml
11+
secrets: inherit
3212

33-
- name: Set up Docker Buildx
34-
uses: docker/setup-buildx-action@v3
35-
36-
- name: Log in to the Container registry
37-
uses: docker/login-action@v3
38-
with:
39-
registry: ghcr.io
40-
username: ${{ github.actor }}
41-
password: ${{ secrets.GITHUB_TOKEN }}
42-
43-
- name: Extract metadata for platform-specific image
44-
id: meta
45-
uses: docker/metadata-action@v5
46-
with:
47-
images: ghcr.io/${{ steps.repo.outputs.name }}
48-
tags: |
49-
type=ref,event=branch
50-
type=ref,event=tag
51-
type=raw,value=latest,enable=true
52-
flavor:
53-
suffix=-{{platform_dash}}
54-
latest=false
55-
56-
- name: Build and push platform-specific image
57-
uses: docker/build-push-action@v5
58-
with:
59-
context: .
60-
platforms: ${{ matrix.platform }}
61-
push: true
62-
tags: ${{ steps.meta.outputs.tags }}
63-
labels: ${{ steps.meta.outputs.labels }}
64-
cache-from: type=gha
65-
cache-to: type=gha,mode=max
13+
build-arm64:
14+
uses: ./.github/workflows/publish-arm64.yml
15+
secrets: inherit
6616

6717
manifest:
68-
needs: build
18+
needs: [build-amd64, build-arm64]
6919
runs-on: ubuntu-latest
7020
permissions:
21+
contents: read
7122
packages: write
7223

7324
steps:
74-
- name: Prepare repository name in lowercase
25+
- name: "Prepare repository name in lowercase"
7526
id: repo
7627
run: echo "name=$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT
7728

@@ -97,6 +48,6 @@ jobs:
9748
for tag in ${{ steps.meta.outputs.tags }}; do
9849
echo "Creating manifest for ${tag}"
9950
docker buildx imagetools create --tag "${tag}" \
100-
"${tag}-linux-amd64" \
101-
"${tag}-linux-arm64"
51+
"${tag}-amd64" \
52+
"${tag}-arm64"
10253
done
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Publish Docker AMD64
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
tags: ["*"]
7+
8+
jobs:
9+
call-build-workflow:
10+
uses: ./.github/workflows/docker-build.yml
11+
with:
12+
platform: linux/amd64
13+
suffix: -amd64
14+
runner: ubuntu-latest
15+
permissions:
16+
contents: read
17+
packages: write
18+
secrets:
19+
token: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Publish Docker ARM64
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
tags: ["*"]
7+
8+
jobs:
9+
call-build-workflow:
10+
uses: ./.github/workflows/docker-build.yml
11+
with:
12+
platform: linux/arm64
13+
suffix: -arm64
14+
runner: ubuntu-22.04-arm
15+
permissions:
16+
contents: read
17+
packages: write
18+
secrets:
19+
token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)