From c66068c803c51a5ffc129af13704ae6456220203 Mon Sep 17 00:00:00 2001 From: Tomas Date: Mon, 3 Jun 2024 17:09:55 +0100 Subject: [PATCH] Create docker-build.yml for github cicd auto build and push docker image --- .github/workflows/docker-build.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/docker-build.yml diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml new file mode 100644 index 0000000..fff43a6 --- /dev/null +++ b/.github/workflows/docker-build.yml @@ -0,0 +1,25 @@ +name: Build Docker Image + +on: + push: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Login to Amazon ECR + uses: aws-actions/amazon-ecr-login@v1 + + - name: Build Docker image + run: docker build -t note-keeping-app:latest . + + - name: Tag Docker image + run: docker tag note-keeping-app:latest 188401947203.dkr.ecr.us-east-1.amazonaws.com/note_keeping_app:latest + + - name: Push Docker image to Amazon ECR + run: docker push 188401947203.dkr.ecr.us-east-1.amazonaws.com/note-keeping-app:latest