Skip to content

Merge pull request #4 from kaiachain/feat/add-dockerfile-and-CI #1

Merge pull request #4 from kaiachain/feat/add-dockerfile-and-CI

Merge pull request #4 from kaiachain/feat/add-dockerfile-and-CI #1

Workflow file for this run

name: production-mainnet-fee-delegation-CI
on:
push:
branches:
- main
jobs:
build-and-push-image-to-ECR:
permissions:
id-token: write
contents: read
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: Get AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ vars.AWS_IAM_ROLE_ARN_PROD}}
role-session-name: SessionForKlaytnActions
aws-region: ${{ vars.AWS_REGION_PROD}}
- name: Login to Amazon ECR
uses: aws-actions/amazon-ecr-login@v2
id: login-ecr
- name: Extract commit hash
id: vars
run: echo "::set-output name=hash::$(git rev-parse --short HEAD)"
- name: Build, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: ${{ vars.ECR_REPOSITORY_MAINNET }}
IMAGE_TAG: ${{ steps.vars.outputs.hash }}
API_URL: ${{ vars.MAINNET_API_URL }}
run: |
echo "NEXT_PUBLIC_API_URL= $API_URL" > .env.production
cat .env.production
docker build -f dockerfile --build-arg VERSION=$IMAGE_TAG -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY -a