Skip to content

Commit ac517bf

Browse files
authored
Merge pull request #231 from lihuacai168/chore/arm-image
feat: support arm64
2 parents 73b1503 + 4930485 commit ac517bf

File tree

2 files changed

+99
-11
lines changed

2 files changed

+99
-11
lines changed

.github/workflows/upload_app_image.yml

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@ on:
1212
- 'requirements.txt'
1313
- '!./web/**'
1414
jobs:
15-
build_app_image:
15+
build_amd64:
1616
runs-on: ubuntu-latest
1717

1818
env:
1919
DOCKERHUB_USERNAME: rikasai
2020
DOCKER_REPOSITORY_NAME: fast-runner-backend
21+
ARCH: amd64
2122

2223
steps:
2324
- name: Check out the repository
@@ -38,7 +39,7 @@ jobs:
3839
GIT_TAG=$(git describe --tags --exact-match ${{ github.sha }} 2> /dev/null || echo "")
3940
echo "GIT_TAG=$GIT_TAG" >> $GITHUB_ENV
4041
41-
- name: Build APP Image
42+
- name: Build AMD64 Image
4243
uses: docker/build-push-action@v2
4344
with:
4445
context: .
@@ -47,4 +48,46 @@ jobs:
4748
push: true
4849
tags: |
4950
${{ env.DOCKERHUB_USERNAME }}/${{ env.DOCKER_REPOSITORY_NAME }}:latest
51+
${{ env.DOCKERHUB_USERNAME }}/${{ env.DOCKER_REPOSITORY_NAME }}:latest-amd64
5052
${{ env.GIT_TAG != '' && format('{0}/{1}:{2}', env.DOCKERHUB_USERNAME, env.DOCKER_REPOSITORY_NAME, env.GIT_TAG) || '' }}
53+
${{ env.GIT_TAG != '' && format('{0}/{1}:{2}-amd64', env.DOCKERHUB_USERNAME, env.DOCKER_REPOSITORY_NAME, env.GIT_TAG) || '' }}
54+
55+
build_arm64:
56+
runs-on: ubuntu-24.04-arm
57+
58+
env:
59+
DOCKERHUB_USERNAME: rikasai
60+
DOCKER_REPOSITORY_NAME: fast-runner-backend
61+
ARCH: arm64
62+
63+
steps:
64+
- name: Check out the repository
65+
uses: actions/checkout@v2
66+
67+
- name: Set up Docker Buildx
68+
uses: docker/setup-buildx-action@v1
69+
70+
- name: Log in to Docker Hub
71+
uses: docker/login-action@v2
72+
with:
73+
username: ${{ secrets.DOCKERHUB_USERNAME }}
74+
password: ${{ secrets.DOCKERHUB_TOKEN }}
75+
76+
- name: Get Git tag if exists
77+
id: get_tag
78+
run: |
79+
GIT_TAG=$(git describe --tags --exact-match ${{ github.sha }} 2> /dev/null || echo "")
80+
echo "GIT_TAG=$GIT_TAG" >> $GITHUB_ENV
81+
82+
- name: Build ARM64 Image
83+
uses: docker/build-push-action@v2
84+
with:
85+
context: .
86+
file: ./Dockerfile
87+
platforms: linux/arm64
88+
push: true
89+
tags: |
90+
${{ env.DOCKERHUB_USERNAME }}/${{ env.DOCKER_REPOSITORY_NAME }}:latest
91+
${{ env.DOCKERHUB_USERNAME }}/${{ env.DOCKER_REPOSITORY_NAME }}:latest-arm64
92+
${{ env.GIT_TAG != '' && format('{0}/{1}:{2}', env.DOCKERHUB_USERNAME, env.DOCKER_REPOSITORY_NAME, env.GIT_TAG) || '' }}
93+
${{ env.GIT_TAG != '' && format('{0}/{1}:{2}-arm64', env.DOCKERHUB_USERNAME, env.DOCKER_REPOSITORY_NAME, env.GIT_TAG) || '' }}

.github/workflows/upload_web_image.yml

Lines changed: 54 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,17 @@ on:
1212
- '**/*.py'
1313

1414
jobs:
15-
build_and_push:
15+
build_amd64:
1616
runs-on: ubuntu-latest
17-
1817
env:
1918
DOCKERHUB_USERNAME: rikasai
2019
DOCKER_REPOSITORY_NAME: fast-runner-frontend
20+
ARCH: amd64
2121

2222
steps:
2323
- name: Check out the repository
2424
uses: actions/checkout@v4
2525

26-
# Cache yarn dependencies
2726
- name: Cache yarn dependencies
2827
uses: actions/cache@v2
2928
with:
@@ -32,11 +31,8 @@ jobs:
3231
restore-keys: |
3332
${{ runner.os }}-yarn-
3433
35-
# - name: Set up QEMU
36-
# uses: docker/setup-qemu-action@v3
37-
38-
# - name: Set up Docker Buildx
39-
# uses: docker/setup-buildx-action@v3
34+
- name: Set up Docker Buildx
35+
uses: docker/setup-buildx-action@v1
4036

4137
- name: Log in to Docker Hub
4238
uses: docker/login-action@v2
@@ -50,7 +46,7 @@ jobs:
5046
GIT_TAG=$(git describe --tags --exact-match ${{ github.sha }} 2> /dev/null || echo "")
5147
echo "GIT_TAG=$GIT_TAG" >> $GITHUB_ENV
5248
53-
- name: Build and push Docker image
49+
- name: Build and push AMD64 Docker image
5450
uses: docker/build-push-action@v2
5551
with:
5652
context: ./web
@@ -59,4 +55,53 @@ jobs:
5955
push: true
6056
tags: |
6157
${{ env.DOCKERHUB_USERNAME }}/${{ env.DOCKER_REPOSITORY_NAME }}:latest
58+
${{ env.DOCKERHUB_USERNAME }}/${{ env.DOCKER_REPOSITORY_NAME }}:latest-amd64
59+
${{ env.GIT_TAG != '' && format('{0}/{1}:{2}', env.DOCKERHUB_USERNAME, env.DOCKER_REPOSITORY_NAME, env.GIT_TAG) || '' }}
60+
${{ env.GIT_TAG != '' && format('{0}/{1}:{2}-amd64', env.DOCKERHUB_USERNAME, env.DOCKER_REPOSITORY_NAME, env.GIT_TAG) || '' }}
61+
62+
build_arm64:
63+
runs-on: ubuntu-22.04-arm
64+
env:
65+
DOCKERHUB_USERNAME: rikasai
66+
DOCKER_REPOSITORY_NAME: fast-runner-frontend
67+
ARCH: arm64
68+
69+
steps:
70+
- name: Check out the repository
71+
uses: actions/checkout@v4
72+
73+
- name: Cache yarn dependencies
74+
uses: actions/cache@v2
75+
with:
76+
path: ./web/node_modules
77+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
78+
restore-keys: |
79+
${{ runner.os }}-yarn-
80+
81+
- name: Set up Docker Buildx
82+
uses: docker/setup-buildx-action@v1
83+
84+
- name: Log in to Docker Hub
85+
uses: docker/login-action@v2
86+
with:
87+
username: ${{ secrets.DOCKERHUB_USERNAME }}
88+
password: ${{ secrets.DOCKERHUB_TOKEN }}
89+
90+
- name: Get Git tag if exists
91+
id: get_tag
92+
run: |
93+
GIT_TAG=$(git describe --tags --exact-match ${{ github.sha }} 2> /dev/null || echo "")
94+
echo "GIT_TAG=$GIT_TAG" >> $GITHUB_ENV
95+
96+
- name: Build and push ARM64 Docker image
97+
uses: docker/build-push-action@v2
98+
with:
99+
context: ./web
100+
file: ./web/Dockerfile-build
101+
platforms: linux/arm64
102+
push: true
103+
tags: |
104+
${{ env.DOCKERHUB_USERNAME }}/${{ env.DOCKER_REPOSITORY_NAME }}:latest
105+
${{ env.DOCKERHUB_USERNAME }}/${{ env.DOCKER_REPOSITORY_NAME }}:latest-arm64
62106
${{ env.GIT_TAG != '' && format('{0}/{1}:{2}', env.DOCKERHUB_USERNAME, env.DOCKER_REPOSITORY_NAME, env.GIT_TAG) || '' }}
107+
${{ env.GIT_TAG != '' && format('{0}/{1}:{2}-arm64', env.DOCKERHUB_USERNAME, env.DOCKER_REPOSITORY_NAME, env.GIT_TAG) || '' }}

0 commit comments

Comments
 (0)