Skip to content

Commit 72cd3a5

Browse files
committed
chore: add workflow to build arm appflowy web image
1 parent 7a53e13 commit 72cd3a5

File tree

1 file changed

+71
-10
lines changed

1 file changed

+71
-10
lines changed

.github/workflows/web_docker.yml

Lines changed: 71 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,30 @@ name: AppFlowy Web image build and push
22
on:
33
workflow_dispatch:
44
inputs:
5-
appflowy_web_version:
5+
version:
66
description: 'AppFlowy Web version'
77
required: true
8+
env:
9+
DOCKERHUB_REPO: appflowyinc/appflowy_web
810
jobs:
9-
appflowy_web_image:
10-
runs-on: ubuntu-22.04
11+
build:
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
matrix:
15+
include:
16+
- os: ubuntu-24.04
17+
platform: linux/amd64
18+
- os: ubuntu-24.04-arm
19+
platform: linux/arm64
1120
steps:
21+
- name: Prepare
22+
run: |
23+
PLATFORM=${{ matrix.platform }}
24+
VERSION=${{ github.event.inputs.version }}
25+
IMAGE_TAG=${VERSION#v}
26+
echo "PLATFORM_PAIR=${PLATFORM//\//-}" >> $GITHUB_ENV
27+
echo "IMAGE_TAG=${IMAGE_TAG}" >> $GITHUB_ENV
28+
1229
- name: Check out the repository
1330
uses: actions/checkout@v3
1431
with:
@@ -17,17 +34,61 @@ jobs:
1734
- name: Set up QEMU
1835
uses: docker/setup-qemu-action@v3
1936

20-
- name: Set up Docker Buildx
21-
uses: docker/setup-buildx-action@v3
22-
2337
- name: Log in to Docker Hub
2438
uses: docker/login-action@v3
2539
with:
2640
username: ${{ secrets.DOCKER_HUB_USERNAME }}
2741
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
2842

29-
- name: Build AppFlowy Web
43+
- name: Set up Docker Buildx
44+
uses: docker/setup-buildx-action@v3
45+
46+
- name: Build and push by digest
47+
id: build
48+
uses: docker/build-push-action@v6
49+
with:
50+
platforms: ${{ matrix.platform }}
51+
tags: ${{ env.IMAGE_TAG }},latest
52+
build-args: VERSION=${{ github.event.inputs.version }}
53+
context: docker/web
54+
outputs: type=image,name=${{ env.DOCKERHUB_REPO }},push-by-digest=true,name-canonical=true,push=true
55+
56+
- name: Export digest
57+
run: |
58+
mkdir -p ${{ runner.temp }}/digests
59+
digest="${{ steps.build.outputs.digest }}"
60+
touch "${{ runner.temp }}/digests/${digest#sha256:}"
61+
62+
- name: Upload digest
63+
uses: actions/upload-artifact@v4
64+
with:
65+
name: digests-${{ env.PLATFORM_PAIR }}
66+
path: ${{ runner.temp }}/digests/*
67+
if-no-files-found: error
68+
retention-days: 1
69+
merge:
70+
runs-on: ubuntu-24.04
71+
needs:
72+
- build
73+
steps:
74+
- name: Download digests
75+
uses: actions/download-artifact@v4
76+
with:
77+
path: ${{ runner.temp }}/digests
78+
pattern: digests-*
79+
merge-multiple: true
80+
81+
- name: Login to Docker Hub
82+
uses: docker/login-action@v3
83+
with:
84+
username: ${{ vars.DOCKERHUB_USERNAME }}
85+
password: ${{ secrets.DOCKERHUB_TOKEN }}
86+
87+
- name: Set up Docker Buildx
88+
uses: docker/setup-buildx-action@v3
89+
90+
- name: Create manifest list and push
91+
working-directory: ${{ runner.temp }}/digests
3092
run: |
31-
export VERSION=${{ github.event.inputs.appflowy_web_version }}
32-
export TAG=${VERSION#v}
33-
docker buildx build --build-arg VERSION=${VERSION} --platform linux/amd64,linux/arm64 -t appflowyinc/appflowy-web:${TAG} -t appflowyinc/appflowy-web:latest -f docker/web/Dockerfile docker/web
93+
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
94+
$(printf '${{ env.DOCKERHUB_REPO }}@sha256:%s ' *)

0 commit comments

Comments
 (0)