From d62eba9279641a82d44f7125b0b84819086c39ae Mon Sep 17 00:00:00 2001 From: Daniel Trolezi Date: Sat, 21 Sep 2024 01:48:30 -0300 Subject: [PATCH] Log into ECR after setting credentials --- .github/workflows/ci-cd.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 005594c..160abfa 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -23,17 +23,17 @@ jobs: aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} aws-region: ${{ vars.AWS_REGION }} + - name: Login to Amazon ECR + run: | + aws ecr get-login-password --region ${{ vars.AWS_REGION }} \ + | docker login --username AWS --password-stdin ${{ secrets.ECR_REPOSITORY_URI }} + - name: Build Docker image (Octane) run: docker build . --file Dockerfile.app --tag ${{ vars.DOCKER_IMAGE_TAG }}/octane - name: Build Docker image (Nginx) run: docker build . --file Dockerfile.nginx --tag ${{ vars.DOCKER_IMAGE_TAG }}/nginx - - name: Login to Amazon ECR - run: | - aws ecr get-login-password --region ${{ vars.AWS_REGION }} \ - | docker login --username AWS --password-stdin ${{ secrets.ECR_REPOSITORY_URI }} - - name: Tag Docker images run: | docker tag ${{ vars.DOCKER_IMAGE_TAG }}/octane:latest ${{ secrets.ECR_REPOSITORY_URI }}:latest-octane