From 495a5f5b7feb3a96289ec7dc1abfca6b9b704704 Mon Sep 17 00:00:00 2001 From: jorbenzhu Date: Mon, 18 Mar 2024 15:28:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=B5=81=E6=B0=B4=E7=BA=BF?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E5=90=84arch=E4=B8=8B=E7=9A=84docker?= =?UTF-8?q?=E9=95=9C=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../workflows/docker_build_multi_platform.yml | 29 +++++++++++++++++++ .github/workflows/release_latest.yml | 28 ++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 .github/workflows/docker_build_multi_platform.yml create mode 100644 .github/workflows/release_latest.yml diff --git a/.github/workflows/docker_build_multi_platform.yml b/.github/workflows/docker_build_multi_platform.yml new file mode 100644 index 0000000..c6f0029 --- /dev/null +++ b/.github/workflows/docker_build_multi_platform.yml @@ -0,0 +1,29 @@ +name: Create and publish Multi-platform image + +on: + push: + tags: + - '*' + +jobs: + build-and-push-image-to-dockerhub: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + platforms: linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7,linux/386 + push: true + tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }}:${{ github.ref_name }} \ No newline at end of file diff --git a/.github/workflows/release_latest.yml b/.github/workflows/release_latest.yml new file mode 100644 index 0000000..e9ef6ec --- /dev/null +++ b/.github/workflows/release_latest.yml @@ -0,0 +1,28 @@ +name: Create the latest version + +on: + release: + types: [ published ] + +jobs: + build-and-push-image-to-dockerhub: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + platforms: linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7,linux/386 + push: true + tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }}:latest \ No newline at end of file