Fixes #15: Add Azure build and push to ACR workflow #16
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: Docker Azure deployment | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
pull_request: | |
jobs: | |
build: | |
uses: ai-cfia/github-workflows/.github/workflows/workflow-build-push-container-azure.yml@main | |
with: | |
container-name: ${{ github.event.repository.name }} | |
tag: ${{ github.sha }} | |
secrets: inherit | |
deploy: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v2 | |
- name: Login to Azure | |
uses: azure/login@v1 | |
with: | |
creds: ${{ secrets.AZURE_CREDENTIALS }} | |
- name: Azure Docker Login | |
uses: azure/docker-login@v1 | |
with: | |
login-server: ${{ secrets.ACR_REGISTRY_NAME }} | |
username: ${{ secrets.ACR_USERNAME }} | |
password: ${{ secrets.ACR_PASSWORD }} | |
- name: Build and push Docker image | |
run: | | |
docker build -t ${{ secrets.ACR_REGISTRY_NAME }}/${{ github.event.repository.name }}:${{ github.sha }} . | |
docker push ${{ secrets.ACR_REGISTRY_NAME }}/${{ github.event.repository.name }}:${{ github.sha }} | |
- name: Deploy to Azure App Service | |
uses: azure/webapps-deploy@v2 | |
with: | |
app-name: ${{ github.event.repository.name }} | |
slot-name: production | |
publish-profile: ${{ secrets.AZURE_PUBLISH_PROFILE }} | |
images: ${{ secrets.ACR_REGISTRY_NAME }}/${{ github.event.repository.name }}:${{ github.sha }} |