From 8aefa7709cc559b9fea1499a8a4131bf3b4dcb55 Mon Sep 17 00:00:00 2001 From: Ahmed Bouhuolia Date: Thu, 9 May 2024 19:25:51 +0200 Subject: [PATCH] feat: Combine arm64 and amd64 in one Github action runner (#437) --- .github/workflows/build-deploy-container.yml | 54 +++----------------- docker-compose.prod.yml | 4 +- 2 files changed, 8 insertions(+), 50 deletions(-) diff --git a/.github/workflows/build-deploy-container.yml b/.github/workflows/build-deploy-container.yml index 7661be470..0da29c037 100644 --- a/.github/workflows/build-deploy-container.yml +++ b/.github/workflows/build-deploy-container.yml @@ -13,10 +13,6 @@ jobs: build-publish-webapp: strategy: fail-fast: false - matrix: - platform: - - linux/amd64 - - linux/arm64 name: Build and deploy webapp container runs-on: ubuntu-latest environment: production @@ -29,9 +25,6 @@ jobs: - 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 @@ -55,10 +48,10 @@ jobs: with: context: ./ file: ./packages/webapp/Dockerfile - platforms: ${{ matrix.platform }} + platforms: linux/amd64,linux/arm64 push: true labels: ${{ steps.meta.outputs.labels }} - outputs: type=image,name=bigcapitalhq/webapp,push-by-digest=true,name-canonical=true,push=true + tags: bigcapitalhq/webapp:latest, bigcapitalhq/webapp:${{github.ref_name}} - name: Export digest run: | @@ -69,7 +62,7 @@ jobs: - name: Upload digest uses: actions/upload-artifact@v4 with: - name: digests-main-${{ env.PLATFORM_PAIR }} + name: digests-webapp path: /tmp/digests/* if-no-files-found: error retention-days: 1 @@ -91,9 +84,6 @@ jobs: - 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 @@ -111,7 +101,7 @@ jobs: with: context: ./ file: ./packages/server/Dockerfile - platforms: ${{ matrix.platform }} + platforms: linux/amd64,linux/arm64 push: true tags: bigcapitalhq/server:latest, bigcapitalhq/server:${{github.ref_name}} labels: ${{ steps.meta.outputs.labels }} @@ -125,45 +115,13 @@ jobs: - name: Upload digest uses: actions/upload-artifact@v4 with: - name: digests-main-${{ env.PLATFORM_PAIR }} + name: digests-server path: /tmp/digests/* if-no-files-found: error retention-days: 1 - + # Send notification to Slack channel. - name: Slack Notification built and published server container successfully. uses: rtCamp/action-slack-notify@v2 env: SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} - - merge: - runs-on: ubuntu-latest - needs: - - build-publish-webapp - steps: - - name: Download digests - uses: actions/download-artifact@v4 - with: - path: /tmp/digests - pattern: digests-* - merge-multiple: true - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Docker meta - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.WEBAPP_IMAGE_NAME }} - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - name: Create manifest list and push - working-directory: /tmp/digests - run: | - docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ - $(printf '${{ env.WEBAPP_IMAGE_NAME }}@sha256:%s ' *) - - name: Inspect image - run: | - docker buildx imagetools inspect ${{ env.WEBAPP_IMAGE_NAME }}:${{ steps.meta.outputs.version }} diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 9620598e4..5a71de09f 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -25,12 +25,12 @@ services: webapp: container_name: bigcapital-webapp - image: ghcr.io/bigcapitalhq/webapp:latest + image: bigcapitalhq/webapp:latest restart: on-failure server: container_name: bigcapital-server - image: ghcr.io/bigcapitalhq/server:latest + image: bigcapitalhq/server:latest expose: - '3000' links: