From 9cd959a49d1ba64092dae7ecb1361553f9bf1b61 Mon Sep 17 00:00:00 2001 From: notchjpl <128665993+notchjpl@users.noreply.github.com> Date: Thu, 12 Feb 2026 20:30:03 -0300 Subject: [PATCH] build multiplatform --- .github/workflows/aws_prod_release.yml | 41 +++++++++++++------------- Dockerfile | 2 +- 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/.github/workflows/aws_prod_release.yml b/.github/workflows/aws_prod_release.yml index 3550e1a..6f60adf 100644 --- a/.github/workflows/aws_prod_release.yml +++ b/.github/workflows/aws_prod_release.yml @@ -16,13 +16,13 @@ concurrency: permissions: id-token: write # This is required for requesting the JWT contents: read # This is required for actions/checkout + jobs: Build: runs-on: ubuntu-latest outputs: service: ${{ steps.sername.outputs.service }} steps: - - name: Checkout uses: actions/checkout@v4 with: @@ -55,7 +55,9 @@ jobs: - run: CI=false npm run build - name: Set up QEMU - uses: docker/setup-qemu-action@v3.0.0 + uses: docker/setup-qemu-action@v3 + with: + platforms: arm64,amd64 - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v4 @@ -71,6 +73,7 @@ jobs: uses: docker/setup-buildx-action@v3 with: buildkitd-flags: --debug + driver-opts: image=moby/buildkit:latest - name: Image Metadata id: metadata @@ -79,26 +82,23 @@ jobs: images: ${{ steps.login-ecr.outputs.registry }}/${{ env.REPOSITORY }} tags: | type=raw,value=${{ github.event.repository.name }}-${{ github.event.release.tag_name }} - - - name: Image Metadata - id: metadata-latest - uses: docker/metadata-action@v5 - with: - images: ${{ steps.login-ecr.outputs.registry }}/${{ env.REPOSITORY }} - tags: | type=raw,value=${{ github.event.repository.name }}-latest - - name: Build and version tag - run: | - docker build --build-arg REF=${{ github.ref}} --build-arg COMMIT_HASH=$(git rev-parse --short ${{ github.sha }}) -t ${{ steps.metadata.outputs.tags }} . - docker tag ${{ steps.metadata.outputs.tags }} ${{ steps.metadata-latest.outputs.tags }} - - - name: push docker image to Amazon ECR - run: | - docker push ${{ steps.metadata.outputs.tags }} - docker push ${{ steps.metadata-latest.outputs.tags }} + - name: Build and push multi-platform images to ECR + uses: docker/build-push-action@v5 + with: + context: . + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ steps.metadata.outputs.tags }} + build-args: | + REF=${{ github.ref }} + COMMIT_HASH=${{ github.sha }} + cache-from: type=gha + cache-to: type=gha,mode=max + provenance: false + sbom: false - deploy_matrix: runs-on: ubuntu-latest needs: Build @@ -114,5 +114,4 @@ jobs: - name: deploy run: | - aws ecs update-service --cluster ${{ env.ECS_Cluster }} --service topia-${{ env.ENV }}-${{ matrix.service }}0 --force-new-deployment - + aws ecs update-service --cluster ${{ env.ECS_Cluster }} --service topia-${{ env.ENV }}-${{ matrix.service }}0 --force-new-deployment \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 662c821..282d326 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM --platform=linux/arm64 node:20.10-alpine3.19 +FROM node:20.10-alpine3.19 WORKDIR /app ARG REF ARG COMMIT_HASH