From f7c05e88df8246ef281d7cb1b1418342ab0327ba Mon Sep 17 00:00:00 2001 From: Minh Nguyen <58201417+meomeocoj@users.noreply.github.com> Date: Fri, 16 Feb 2024 16:36:13 +0700 Subject: [PATCH] Cicd/split job build arm (#153) * perf: split build arm64 to another job * fix: make cicd run ubuntu-latest --- .github/workflows/publish_backend.yml | 57 ++++++++++++++++++++++++--- 1 file changed, 52 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish_backend.yml b/.github/workflows/publish_backend.yml index 79589a60..f6dca2cd 100644 --- a/.github/workflows/publish_backend.yml +++ b/.github/workflows/publish_backend.yml @@ -15,11 +15,11 @@ env: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} jobs: - docker: + docker-amd: strategy: matrix: node: ["18.18.0"] - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 @@ -61,11 +61,58 @@ jobs: context: . cache-from: type=registry,ref=oraichain/defi_oraidex-backend:buildcache cache-to: type=registry,ref=oraichain/defi_oraidex-backend:buildcache,mode=max - platforms: linux/amd64,linux/arm64 + platforms: linux/amd64 - swarm: + docker-arm: + strategy: + matrix: + node: ["18.18.0"] runs-on: ubuntu-20.04 - needs: docker + 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: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + oraichain/defi_oraidex-backend + tags: | + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=sha,enable=true,priority=100,prefix=,suffix=-arm64,format=short + + - name: Login to DockerHub + if: github.event_name != 'pull_request' + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v5 + with: + build-args: | + GIT_COMMIT=${{ env.GIT_COMMIT }} + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + context: . + cache-from: type=registry,ref=oraichain/defi_oraidex-backend:buildcache-arm64 + cache-to: type=registry,ref=oraichain/defi_oraidex-backend:buildcache-arm64,mode=max + platforms: linux/arm64 + swarm: + runs-on: ubuntu-latest + needs: docker-amd steps: - name: Extract SHA id: extract_sha