Skip to content

Commit

Permalink
use buildx to create both amd64 and arm64 images
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Yavorsky committed May 31, 2024
1 parent 736a591 commit 6ac637f
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions .github/workflows/aws-ecs-deploy-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ env:
AWS_REGION: us-east-1
DOCKERFILE: ./backend/Dockerfile.cloud
DOCKER_PATH: ./
PLATFORMS: linux/amd64,linux/arm64
jobs:
setup_env:
name: Set-up environment
Expand Down Expand Up @@ -66,21 +67,22 @@ jobs:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Build & Push Image to ECR
uses: mikeyavorsky/aws-ecr-action@master
- name: Login to ECR
uses: docker/login-action@v3
with:
registry: ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ env.AWS_REGION }}.amazonaws.com
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v5
with:
access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
account_id: ${{ secrets.AWS_ACCOUNT_ID }}
repo: ${{ needs.setup_env.outputs.AWS_APPENV }}
region: ${{ env.AWS_REGION }}
tags: latest,${{ needs.setup_env.outputs.IMAGE_TAG }}
dockerfile: ${{ env.DOCKERFILE }}
path: ${{ env.DOCKER_PATH }}
extra_build_args: "--platform=linux/arm64"
context: ${{ env.DOCKER_PATH }}
file: ${{ env.DOCKERFILE }}
platforms: ${{ env.PLATFORMS }}
push: true
tags: ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ env.AWS_REGION }}.amazonaws.com/${{ needs.setup_env.outputs.AWS_APPENV }}:${{ needs.setup_env.outputs.IMAGE_TAG }}, ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ env.AWS_REGION }}.amazonaws.com/${{ needs.setup_env.outputs.AWS_APPENV }}:latest
deploy:
name: Deploy to AWS ECS
runs-on: ubuntu-latest
Expand Down

0 comments on commit 6ac637f

Please sign in to comment.