Skip to content

changed registry alias #14

changed registry alias

changed registry alias #14

name: Build and Push to ECR
on:
push:
branches:
- main
- master
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
# - name: Configure AWS Credentials
# uses: aws-actions/configure-aws-credentials@v4
# with:
# role-to-assume: arn:aws:iam::381492107876:role/IIC2173-2
# aws-region: us-east-1
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID0}}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY0}}
aws-region: us-east-1
- name: Get ECR Repository URI
id: ecr-repo
run: |
echo "::set-output name=uri::public.ecr.aws/v9b5f4l8/iic2173-api"
# Use the URI directly, assuming it's constant
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
with:
registry-type: public
- name: Build, tag, and push docker image to Amazon ECR Public
env:
REGISTRY: ${{ steps.login-ecr-public.outputs.registry }}
REGISTRY_ALIAS: 381492107876
REPOSITORY: iic2173-api
IMAGE_TAG: latest
run: |
docker build -t $REGISTRY/$REGISTRY_ALIAS/$REPOSITORY:$IMAGE_TAG .
docker push $REGISTRY/$REGISTRY_ALIAS/$REPOSITORY:$IMAGE_TAG