Feature/azure-ci-cd (#57) #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build, Push and Deploy Docker Image of Core App | |
on: | |
push: | |
branches: master | |
paths: 'src/**' | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Login to Azure | |
uses: azure/login@v1 | |
with: | |
creds: ${{ secrets.AZURE_CREDENTIALS }} | |
- name: Login to Azure Container Registry | |
uses: azure/docker-login@v1 | |
with: | |
login-server: ${{ vars.ACR_NAME }}.azurecr.io | |
username: ${{ secrets.ACR_USERNAME }} | |
password: ${{ secrets.ACR_PASSWORD }} | |
- name: Build and Push Docker Image | |
run: | | |
docker build -t ${{ vars.ACR_NAME }}.azurecr.io/${{ vars.CORE_APP_TAG }}:${{ github.sha }} . | |
docker push ${{ vars.ACR_NAME }}.azurecr.io/${{ vars.CORE_APP_TAG }}:${{ github.sha }} | |
- name: Deploy to Azure Container App | |
run: | | |
az containerapp update \ | |
--name ${{ vars.CORE_APP_CONTAINER_NAME }} \ | |
--resource-group ${{ vars.RESOURCE_GROUP_NAME }} \ | |
--image ${{ vars.ACR_NAME }}.azurecr.io/${{ vars.CORE_APP_TAG }}:${{ github.sha }} | |