From 78c7f255ec4c26f695b05b8e638ff66438fcf2df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8A=B1=E8=8F=9C?= Date: Tue, 25 Mar 2025 17:20:30 +0000 Subject: [PATCH] =?UTF-8?q?chore:=20=E6=9B=B4=E6=96=B0=20GitHub=20Actions?= =?UTF-8?q?=20=E5=B7=A5=E4=BD=9C=E6=B5=81=EF=BC=8C=E6=B7=BB=E5=8A=A0=20Doc?= =?UTF-8?q?ker=20Buildx=20=E6=94=AF=E6=8C=81=E5=B9=B6=E6=9E=84=E5=BB=BA?= =?UTF-8?q?=E5=A4=9A=E6=9E=B6=E6=9E=84=20Docker=20=E9=95=9C=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 729e6cfe..dd75abaf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,6 +3,8 @@ name: Continuous Deployment on: push: branches: [ master ] + workflow_dispatch: + jobs: build-readme-file: @@ -35,7 +37,12 @@ jobs: steps: # Checkout, install tools.. - uses: actions/checkout@v2 - # Use docker to build current directory ./Dockfile + + # 设置Docker BuildX + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + # Login to GitHub Container Registry - name: Login to GitHub Container Registry uses: docker/login-action@v1 with: @@ -43,7 +50,12 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and push the Docker image - run: | - docker build . --tag ghcr.io/anduin2017/how-to-cook:latest - docker push ghcr.io/anduin2017/how-to-cook:latest \ No newline at end of file + # 构建并推送多架构Docker镜像 + - name: Build and push multi-arch Docker image + uses: docker/build-push-action@v3 + with: + context: . + push: true + platforms: linux/amd64,linux/arm64 + tags: | + ghcr.io/${{ github.repository }}:latest \ No newline at end of file