Skip to content

Commit f412348

Browse files
committed
chore: arm
1 parent 8b72f77 commit f412348

1 file changed

Lines changed: 47 additions & 25 deletions

File tree

.github/workflows/build.yml

Lines changed: 47 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,45 +6,67 @@ on:
66
- "main"
77
workflow_dispatch:
88

9+
concurrency:
10+
group: build
11+
cancel-in-progress: true
12+
913
jobs:
10-
docker:
11-
runs-on: ubuntu-latest
12-
strategy:
13-
matrix:
14-
platform: [
15-
linux/amd64,
16-
linux/arm64
17-
]
14+
build-amd64:
15+
runs-on: ubuntu-24.04
16+
steps:
17+
- name: Check out the repo
18+
uses: actions/checkout@v4
19+
- name: Set up Docker Buildx
20+
uses: docker/setup-buildx-action@v3
21+
- name: Log in to GitHub Docker Registry
22+
uses: docker/login-action@v3
23+
with:
24+
registry: ghcr.io
25+
username: ${{ github.actor }}
26+
password: ${{ secrets.GITHUB_TOKEN }}
27+
- name: Build and push AMD64 image
28+
uses: docker/build-push-action@v6
29+
with:
30+
context: .
31+
file: ./Dockerfile
32+
push: true
33+
platforms: linux/amd64
34+
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/api:buildcache-amd64
35+
cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/api:buildcache-amd64,mode=max
36+
tags: |
37+
ghcr.io/${{ github.repository_owner }}/api:latest-amd64
38+
ghcr.io/${{ github.repository_owner }}/api:${{ github.sha }}-amd64
39+
build-arm64:
40+
runs-on: ubuntu-24.04-arm
1841
steps:
1942
- name: Check out the repo
20-
uses: actions/checkout@v3
43+
uses: actions/checkout@v4
2144
- name: Set up Docker Buildx
22-
uses: docker/setup-buildx-action@v2
45+
uses: docker/setup-buildx-action@v3
2346
- name: Log in to GitHub Docker Registry
24-
uses: docker/login-action@v2
47+
uses: docker/login-action@v3
2548
with:
2649
registry: ghcr.io
2750
username: ${{ github.actor }}
2851
password: ${{ secrets.GITHUB_TOKEN }}
29-
- name: Extract platform info
30-
id: platform
31-
run: echo "arch=$(echo ${{ matrix.platform }} | cut -d'/' -f2)" >> $GITHUB_OUTPUT
32-
- name: Build container image
52+
- name: Build and push ARM64 image
3353
uses: docker/build-push-action@v6
3454
with:
55+
context: .
56+
file: ./Dockerfile
3557
push: true
36-
platforms: ${{ matrix.platform }}
37-
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/api:buildcache-${{ steps.platform.outputs.arch }}
38-
cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/api:buildcache-${{ steps.platform.outputs.arch }},mode=max
58+
platforms: linux/arm64
59+
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/api:buildcache-arm64
60+
cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/api:buildcache-arm64,mode=max
3961
tags: |
40-
ghcr.io/${{ github.repository_owner }}/api:${{ github.sha }}-${{ steps.platform.outputs.arch }}
41-
ghcr.io/${{ github.repository_owner }}/api:latest-${{ steps.platform.outputs.arch }}
62+
ghcr.io/${{ github.repository_owner }}/api:latest-arm64
63+
ghcr.io/${{ github.repository_owner }}/api:${{ github.sha }}-arm64
4264
merge:
43-
needs: docker
65+
needs: [build-amd64, build-arm64]
4466
runs-on: ubuntu-latest
4567
steps:
4668
- name: Log in to GitHub Docker Registry
47-
uses: docker/login-action@v2
69+
uses: docker/login-action@v3
4870
with:
4971
registry: ghcr.io
5072
username: ${{ github.actor }}
@@ -53,12 +75,12 @@ jobs:
5375
run: |
5476
docker buildx imagetools create -t ghcr.io/${{ github.repository_owner }}/api:latest \
5577
ghcr.io/${{ github.repository_owner }}/api:latest-amd64 \
56-
# ghcr.io/${{ github.repository_owner }}/api:latest-arm64
78+
ghcr.io/${{ github.repository_owner }}/api:latest-arm64
5779
docker buildx imagetools create -t ghcr.io/${{ github.repository_owner }}/api:${{ github.sha }} \
5880
ghcr.io/${{ github.repository_owner }}/api:${{ github.sha }}-amd64 \
59-
# ghcr.io/${{ github.repository_owner }}/api:${{ github.sha }}-arm64
81+
ghcr.io/${{ github.repository_owner }}/api:${{ github.sha }}-arm64
6082
- name: Delete Package Versions
61-
uses: actions/delete-package-versions@v5.0.0
83+
uses: actions/delete-package-versions@v5
6284
with:
6385
package-name: api
6486
package-type: container

0 commit comments

Comments
 (0)