Skip to content

Forte Rules Engine Gas Reports (#484) #115

Forte Rules Engine Gas Reports (#484)

Forte Rules Engine Gas Reports (#484) #115

name: Build and Push Images
on:
push:
branches:
- main
workflow_dispatch:
env:
AWS_REGION: us-east-1
ECR_REPOSITORY: ${{ secrets.K8S_AWS_ACCOUNT_ID }}.dkr.ecr.us-east-1.amazonaws.com/universus-tf
jobs:
build:
runs-on: ubuntu-latest
environment:
name: ${{ github.ref_name }}
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.K8S_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.K8S_AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Set container tags
run: |
echo 'FOUNDRY_BASE_TAG=${{ env.ECR_REPOSITORY }}:foundry-base' >> $GITHUB_ENV
echo 'BASE_TAG=${{ env.ECR_REPOSITORY }}:repo-base-${{ github.ref_name }}' >> $GITHUB_ENV
echo 'ANVIL_IMAGE_TAG=${{ env.ECR_REPOSITORY }}:anvil-${{ github.ref_name }}' >> $GITHUB_ENV
echo 'IMAGE_TAG=${{ env.ECR_REPOSITORY }}:repo-${{ github.ref_name }}' >> $GITHUB_ENV
echo 'TEST_TAG=${{ env.ECR_REPOSITORY }}:repo-${{ github.ref_name }}-test' >> $GITHUB_ENV
- name: Build and push foundry-base
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
target: foundry-base
push: true
tags: ${{ env.FOUNDRY_BASE_TAG }}
cache-from: type=registry,ref=${{ env.FOUNDRY_BASE_TAG }}
cache-to: type=inline
- name: Build and push compiled repo
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
target: compile
push: true
tags: ${{ env.BASE_TAG }}
cache-from: type=registry,ref=${{ env.FOUNDRY_BASE_TAG }}
cache-to: type=inline
- name: Build image to test deployment
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
target: check-deploy
load: true
tags: ${{ env.TEST_TAG }}
cache-from: type=registry,ref=${{ env.BASE_TAG }}
cache-to: type=inline
- name: Run deploy-check and clean up
run: |
docker run --rm ${{ env.TEST_TAG }}
- name: Build and push Anvil
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
target: anvil
push: true
tags: ${{ env.ANVIL_IMAGE_TAG }}
cache-from: type=registry,ref=${{ env.BASE_TAG }}
cache-to: type=inline
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
target: deploy
push: true
tags: ${{ env.IMAGE_TAG }}
cache-from: type=registry,ref=${{ env.BASE_TAG }}
cache-to: type=inline