gh: Use docker output format #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Frontend | |
on: | |
push: | |
permissions: | |
id-token: write | |
contents: read | |
env: | |
AWS_REGION: eu-west-1 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: docker/setup-qemu-action@v3 | |
- uses: docker/setup-buildx-action@v3 | |
- uses: docker/build-push-action@v6 | |
with: | |
context: frontend | |
platforms: linux/arm64 | |
tags: frontend:latest | |
outputs: type=docker,dest=/tmp/frontend_image.tar | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: frontend_image | |
path: /tmp/frontend_image.tar | |
push: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/github-oidc-provider-aws | |
aws-region: ${{ env.AWS_REGION }} | |
- uses: aws-actions/amazon-ecr-login@v2 | |
id: login-ecr | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: frontend_image | |
path: /tmp/ | |
- name: Push to ECR | |
env: | |
REPOSITORY: ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ env.AWS_REGION }}.amazonaws.com/learning-frontend | |
IMAGE_TAG: v${{ github.sha }} | |
run: | | |
docker load --input /tmp/frontend_image.tar | |
docker image tag frontend $REPOSITORY:$IMAGE_TAG | |
docker push $REPOSITORY:$IMAGE_TAG |