From 626a2cb3896021bd5986023771011b976aac6cdc Mon Sep 17 00:00:00 2001 From: Sanjay Singh Rajpoot <67458417+SanjaySinghRajpoot@users.noreply.github.com> Date: Thu, 23 Jun 2022 17:16:23 +0530 Subject: [PATCH] GitHub workflow to push images to Azure Container Registry (#138) * CI/CD: Azure Container Workflow * chore: update the workflow --- .github/workflows/push-to-azure.yml | 46 +++++++++++++++++++++++++++++ .vscode/settings.json | 4 +++ 2 files changed, 50 insertions(+) create mode 100644 .github/workflows/push-to-azure.yml create mode 100644 .vscode/settings.json diff --git a/.github/workflows/push-to-azure.yml b/.github/workflows/push-to-azure.yml new file mode 100644 index 00000000..18dbc180 --- /dev/null +++ b/.github/workflows/push-to-azure.yml @@ -0,0 +1,46 @@ +name: Deploy to Azure Container Registry + +on: [push] + +env: + REGISTRY: mojaglobal.azurecr.io + +jobs: + deploy-rest-api-flint-example: + name: Build and push REST API FLINT Example to ACR + runs-on: ubuntu-latest + steps: + - name: 'Checkout GitHub Action' + uses: actions/checkout@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: 'Login via Azure CLI' + uses: azure/login@v1 + with: + creds: ${{ secrets.AZURE_CREDENTIALS }} + + - name: 'Build and push image' + uses: azure/docker-login@v1 + with: + login-server: ${{ env.REGISTRY }} + username: ${{ secrets.REGISTRY_USERNAME }} + password: ${{ secrets.REGISTRY_PASSWORD }} + + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + with: + images: ${{ env.REGISTRY }}/moja-global/rest_api_flint_example + + - name: Build and push Docker image + uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc + with: + context: ./local/rest_api_flint.example/ + file: "./local/rest_api_flint.example/Dockerfile" + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..3abe33ba --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,4 @@ +{ + "makefile.extensionOutputFolder": "./.vscode", + "esbonio.sphinx.confDir": "" +} \ No newline at end of file