From 4d4c1ec520a69f62f16b2d7f35d19653582f71d1 Mon Sep 17 00:00:00 2001 From: Yoni Yang <76271912+yoni13@users.noreply.github.com> Date: Wed, 9 Oct 2024 18:19:32 +0800 Subject: [PATCH 1/3] Add support for arm64 container --- .github/workflows/main.yml | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d3dbb1d..eaaee41 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,10 +21,26 @@ jobs: node-version: 20 cache: 'pnpm' - run: pnpm install && pnpm build - - name: Build image - run: docker build . --file Dockerfile --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}" + - name: Set up QEMU for multi-architecture builds + uses: docker/setup-qemu-action@v2 + with: + platforms: arm64 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Build multi-arch image (including arm64) + run: | + docker buildx create --use + docker buildx build --platform linux/amd64,linux/arm64 . \ + --file Dockerfile \ + --tag $IMAGE_NAME \ + --label "runnumber=${GITHUB_RUN_ID}" \ + --push + - name: Log in to registry run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin + - name: Push image run: | IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME From 019399b32223f979bb24097b754ca687432f781b Mon Sep 17 00:00:00 2001 From: Yoni Yang <76271912+yoni13@users.noreply.github.com> Date: Wed, 9 Oct 2024 18:47:12 +0800 Subject: [PATCH 2/3] Update main.yml --- .github/workflows/main.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index eaaee41..c0eb054 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -35,8 +35,7 @@ jobs: docker buildx build --platform linux/amd64,linux/arm64 . \ --file Dockerfile \ --tag $IMAGE_NAME \ - --label "runnumber=${GITHUB_RUN_ID}" \ - --push + --label "runnumber=${GITHUB_RUN_ID}" - name: Log in to registry run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin From 2216dc080d6d2e0cd6fe27303d195e9f7c0dc1a0 Mon Sep 17 00:00:00 2001 From: Yoni Yang <76271912+yoni13@users.noreply.github.com> Date: Wed, 9 Oct 2024 19:08:31 +0800 Subject: [PATCH 3/3] Update main.yml --- .github/workflows/main.yml | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c0eb054..a0dc538 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,26 +21,17 @@ jobs: node-version: 20 cache: 'pnpm' - run: pnpm install && pnpm build + - name: Set up QEMU for multi-architecture builds uses: docker/setup-qemu-action@v2 - with: - platforms: arm64 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - - name: Build multi-arch image (including arm64) - run: | - docker buildx create --use - docker buildx build --platform linux/amd64,linux/arm64 . \ - --file Dockerfile \ - --tag $IMAGE_NAME \ - --label "runnumber=${GITHUB_RUN_ID}" - - name: Log in to registry run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin - - name: Push image + - name: Build and Push image run: | IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') @@ -49,5 +40,6 @@ jobs: [ "$VERSION" == "main" ] && VERSION=latest echo IMAGE_ID=$IMAGE_ID echo VERSION=$VERSION - docker tag $IMAGE_NAME $IMAGE_ID:$VERSION - docker push $IMAGE_ID:$VERSION + docker buildx build --push \ + --tag $IMAGE_ID:$VERSION \ + --platform linux/amd64,linux/arm/v7,linux/arm64 .