Skip to content

Commit

Permalink
push to ecr
Browse files Browse the repository at this point in the history
  • Loading branch information
srihari-tf authored Sep 3, 2024
1 parent f15b854 commit 30aa51b
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/public-ecr-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Push image to to ECR

on:
push:
branches:
- 'main'

permissions:
id-token: write
contents: read

jobs:
build:
name: Build Image
runs-on: ubuntu-latest
steps:
- name: Checkoutout code
uses: actions/checkout@v3

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.PUBLIC_ECR_IAM_ROLE_ARN }}
aws-region: us-east-1

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
with:
registry-type: public

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push image
uses: docker/build-push-action@v5
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
REGISTRY_ALIAS: truefoundrycloud
REPOSITORY: nui
IMAGE_TAG: ${{ github.sha }}
with:
context: .
push: true
tags: ${{ env.REGISTRY }}/${{ env.REGISTRY_ALIAS }}/${{ env.REPOSITORY }}:${{ env.IMAGE_TAG }}
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.REGISTRY_ALIAS }}/${{ env.REPOSITORY }}:buildcache
cache-to: mode=max,image-manifest=true,type=registry,ref=${{ env.REGISTRY }}/${{ env.REGISTRY_ALIAS }}/${{ env.REPOSITORY }}:buildcache

0 comments on commit 30aa51b

Please sign in to comment.