From 96768a8349068ca0991be3a02a9c573a9899ae72 Mon Sep 17 00:00:00 2001 From: Sai Barath Date: Tue, 19 Dec 2023 16:36:26 +0530 Subject: [PATCH 1/2] Update Docker image CI workflow and add main workflow --- .github/workflows/docker-image.yml | 18 ------------------ .github/workflows/main.yml | 23 +++++++++++++++++++++++ 2 files changed, 23 insertions(+), 18 deletions(-) delete mode 100644 .github/workflows/docker-image.yml create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml deleted file mode 100644 index d657a63..0000000 --- a/.github/workflows/docker-image.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Docker Image CI - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - -jobs: - - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - name: Build the Docker image - run: docker build . --file Dockerfile --tag my-image-name:$(date +%s) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..e9692d5 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,23 @@ +name: Build a Docker image and Push it to ACR + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: azure/docker-login@v1 + with: + login-server: ${{ secrets.ACR_ENDPOINT }} + username: ${{ secrets.ACR_USERNAME }} + password: ${{ secrets.ACR_PASSWORD }} + - run: | + docker build . -t ${{ secrets.ACR_ENDPOINT }}/mh-service:${{ github.sha }} + docker push ${{ secrets.ACR_ENDPOINT }}/mh-service:${{ github.sha }} From 6ab5ceeef4d6064dc48f560070f633b7572f3bda Mon Sep 17 00:00:00 2001 From: Sai Barath Date: Tue, 19 Dec 2023 16:37:16 +0530 Subject: [PATCH 2/2] Update branch names in GitHub workflow --- .github/workflows/main.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e9692d5..e324225 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,9 +2,9 @@ name: Build a Docker image and Push it to ACR on: push: - branches: [ main ] + branches: [azureFlow] pull_request: - branches: [ main ] + branches: [azureFlow] workflow_dispatch: @@ -15,9 +15,9 @@ jobs: - uses: actions/checkout@v2 - uses: azure/docker-login@v1 with: - login-server: ${{ secrets.ACR_ENDPOINT }} - username: ${{ secrets.ACR_USERNAME }} - password: ${{ secrets.ACR_PASSWORD }} + login-server: ${{ secrets.ACR_ENDPOINT }} + username: ${{ secrets.ACR_USERNAME }} + password: ${{ secrets.ACR_PASSWORD }} - run: | docker build . -t ${{ secrets.ACR_ENDPOINT }}/mh-service:${{ github.sha }} docker push ${{ secrets.ACR_ENDPOINT }}/mh-service:${{ github.sha }}