Skip to content

CD-Azure

CD-Azure #1

Workflow file for this run

name: CD-Azure
#env:
# AZURE_CONTAINER_APP_NAME: demo-container
# AZURE_GROUP_NAME: demo-container
# When this action will be executed
on:
# Automatically trigger it when detected changes in repo. Remove comments to enable
#push:
# branches:
# [ main ]
# Allow mannually trigger
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout to the branch
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Log in to Azure container registry
uses: docker/[email protected]
with:
registry: mycontainers2623.azurecr.io
username: ${{ secrets.ACR_USERNAME }}
password: ${{ secrets.ACR_PASSWORD }}
- name: Lowercase the repo name and username
run: echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV}
- name: Build and push container image to ACR registry
uses: docker/build-push-action@v2
with:
push: true
tags: mycontainers2623.azurecr.io/${{ env.REPO }}:${{ github.sha }}
file: ./Dockerfile
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Azure Login
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Deploy to containerapp
uses: azure/CLI@v1
with:
inlineScript: |
az config set extension.use_dynamic_install=yes_without_prompt
az containerapp registry set -n text-completion2623 -g textCompletion --server mycontainers2623.azurecr.io --username ${{ secrets.ACR_USERNAME }} --password ${{ secrets.ACR_PASSWORD }}
az containerapp update -n text-completion2623 -g textCompletion --cpu 2 --memory 4Gi
az containerapp update -n text-completion2623 -g textCompletion --image demoalfredo.azurecr.io/alfredodeza/huggingface-azure-acr:${{ github.sha }}