From ad7a365f32b0135e97e6806985ec64792a607a45 Mon Sep 17 00:00:00 2001 From: hibobmaster <32976627+hibobmaster@users.noreply.github.com> Date: Thu, 30 Mar 2023 12:51:37 +0800 Subject: [PATCH] Support multi-arch docker build --- .github/workflows/docker.yml | 35 +++++++++++++++++++++++++++-------- Dockerfile | 2 +- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 5b2520eb..5baad6d1 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,6 +1,7 @@ name: Publish Docker image on: + workflow_dispatch: release: types: [published] @@ -9,25 +10,43 @@ jobs: name: Push Docker image to Docker Hub runs-on: ubuntu-latest steps: - - name: Check out the repo + - + name: Check out the repo uses: actions/checkout@v3 - - - name: Log in to Docker Hub - uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 + - + name: Log in to Docker Hub + uses: docker/login-action@v2 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - - name: Extract metadata (tags, labels) for Docker + - + name: Extract metadata (tags, labels) for Docker id: meta - uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + uses: docker/metadata-action@v4 with: images: yidadaa/chatgpt-next-web + tags: | + type=raw,value=latest + type=semver,pattern={{version}} - - name: Build and push Docker image - uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc + - + name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - + name: Build and push Docker image + uses: docker/build-push-action@v4 with: context: . + platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max + \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 314d6c36..f97618e7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ WORKDIR /app COPY package.json yarn.lock* package-lock.json* ./ RUN \ - if [ -f yarn.lock ]; then yarn --frozen-lockfile; \ + if [ -f yarn.lock ]; then yarn install --frozen-lockfile --network-timeout 100000; \ elif [ -f package-lock.json ]; then npm ci; \ else echo "Lockfile not found." && exit 1; \ fi