From 934b5a1bfa9ca08344413dafa5aed9a6e93bdf5e Mon Sep 17 00:00:00 2001 From: Dharshi Balasubramaniyam <139672976+DharshiBalasubramaniyam@users.noreply.github.com> Date: Sat, 29 Jun 2024 18:54:49 +0530 Subject: [PATCH] Update ci-cd.yml --- .github/workflows/ci-cd.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 3fc7ab2..5e203d3 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -43,3 +43,17 @@ jobs: - name: Login to Amazon ECR id: login-ecr uses: aws-actions/amazon-ecr-login@v2 + + - name: Build, tag, and push image to Amazon ECR + id: build-image + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + IMAGE_TAG: ${{ github.sha }} + ECR_REPOSITORY: springboot-ci-cd-practice-registry + run: | + # Build a docker container and + # push it to ECR so that it can + # be deployed to ECS. + docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . + docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG + echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT