Merge pull request #131 from AirWalk-Digital/fix-build #1
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: Build and publish Mulit-Arch Docker images | |
on: | |
workflow_dispatch: | |
push: | |
branches: [main] | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
driver-opts: | | |
image=moby/buildkit:v0.10.6 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build Docker Image | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: ghcr.io/airwalk-digital/airview-next:main | |
secrets: | | |
"FONTAWESOME_NPM_AUTH_TOKEN=${{ secrets.FONTAWESOME_NPM_AUTH_TOKEN }}" | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
role-to-assume: arn:aws:iam::307532178757:role/mdx_github_actions_ecr_push_role | |
aws-region: eu-west-2 | |
- name: Publish image to ECR | |
run: | | |
aws ecr get-login-password --region eu-west-2 | docker login --username AWS --password-stdin 307532178757.dkr.ecr.eu-west-2.amazonaws.com | |
docker tag ghcr.io/airwalk-digital/airview-next:main 307532178757.dkr.ecr.eu-west-2.amazonaws.com/mdx_repo | |
docker push 307532178757.dkr.ecr.eu-west-2.amazonaws.com/mdx_repo | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
role-to-assume: arn:aws:iam::307532178757:role/mdx_execution_role | |
aws-region: eu-west-2 | |
- name: Deploy latest mdx image | |
run: | | |
aws ecs update-service --cluster mdx --service mdx_service --force-new-deployment --region eu-west-2 | |