kernel images (#671) #648
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: Deploys latest code | |
on: | |
push: | |
branches: | |
- master | |
- staging | |
permissions: | |
id-token: write | |
contents: read | |
concurrency: | |
group: deploy-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
backend: | |
runs-on: ubuntu-latest | |
environment: ${{ github.ref == 'refs/heads/master' && 'production' || 'staging' }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ vars.AWS_ROLE_NAME }} | |
aws-region: ${{ vars.AWS_REGION }} | |
- name: Log in to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v2 | |
- name: Create and use a new builder instance | |
run: | | |
docker buildx create --name www-builder --use | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
env: | |
ECR_IMAGE: ${{ vars.ECR_REGISTRY_WWW }}/${{ vars.ECR_REPOSITORY_WWW }} | |
with: | |
context: . | |
file: docker/Dockerfile | |
push: true | |
tags: ${{ env.ECR_IMAGE }}:latest | |
builder: www-builder | |
build-args: | | |
ENVIRONMENT=${{ github.ref == 'refs/heads/master' && 'production' || 'staging' }} | |
COGNITO_AUTHORITY=${{ vars.COGNITO_AUTHORITY }} | |
COGNITO_CLIENT_ID=${{ vars.COGNITO_CLIENT_ID }} | |
cache-from: type=registry,ref=${{ env.ECR_IMAGE }}:cache | |
cache-to: type=registry,mode=max,image-manifest=true,oci-mediatypes=true,ref=${{ env.ECR_IMAGE }}:cache |