From 1a7e8d1c333d16a9f1f4cb3cbc6bbc608d6d2ed6 Mon Sep 17 00:00:00 2001 From: IsaacAndra Date: Wed, 18 Sep 2024 14:30:49 -0300 Subject: [PATCH] =?UTF-8?q?feat:=20Integra=C3=A7=C3=A3o=20Cont=C3=ADnua=20?= =?UTF-8?q?com=20Amazon=20ECR=20e=20ECS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci-app.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.github/workflows/ci-app.yml b/.github/workflows/ci-app.yml index 66f678f..763ebd9 100644 --- a/.github/workflows/ci-app.yml +++ b/.github/workflows/ci-app.yml @@ -33,6 +33,18 @@ jobs: with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} + + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ secrets.AWS_DEFAULT_REGION }} + + - name: Login to Amazon ECR Private + id: login-ecr + uses: aws-actions/amazon-ecr-login@v2 - name: Build Application JAR @@ -45,6 +57,15 @@ jobs: run: docker compose build + - name: Tag and push docker image to Amazon ECR + run: | + docker tag ${{ secrets.DOCKER_USERNAME }}/blog-api-server:latest ${{ secrets.IMAGE_REPO_URL }}:${{ github.run_id }} + docker tag ${{ secrets.DOCKER_USERNAME }}/blog-api-server:latest ${{ secrets.IMAGE_REPO_URL }}:latest + + docker push ${{ secrets.IMAGE_REPO_URL }}:${{ github.run_id }} + docker push ${{ secrets.IMAGE_REPO_URL }}:latest + + - name: Push to Docker Hub Container Registry run: | docker tag ${{ secrets.DOCKER_USERNAME }}/blog-api-server:latest ${{ secrets.DOCKER_USERNAME }}/blog-api-server:${{ github.run_id }}