KeerthiVM's picture
Updated automated deployment for azure
52cf398
name: Build & Deploy to Azure Container Apps
on:
push:
branches:
- main
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Azure Login
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
# - name: Login to Azure
# uses: azure/login@v1
# with:
# client-id: ${{ secrets.AZURE_CLIENT_ID }}
# tenant-id: ${{ secrets.AZURE_TENANT_ID }}
# subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
# client-secret: ${{ secrets.AZURE_CLIENT_SECRET }}
- name: Build Docker image
run: |
docker build -t ${{ secrets.ACR_LOGIN_SERVER }}/translator-app:latest .
- name: Login to Azure Container Registry
run: |
az acr login --name ${{ secrets.ACR_NAME }}
- name: Push Docker image to ACR
run: |
docker push ${{ secrets.ACR_LOGIN_SERVER }}/translator-app:latest
- name: Deploy updated image to Azure Container App
run: |
az containerapp update \
--name ${{ secrets.CONTAINER_APP_NAME }} \
--resource-group ${{ secrets.RESOURCE_GROUP }} \
--image ${{ secrets.ACR_LOGIN_SERVER }}/translator-app:latest \
--set-env-vars HF_TOKEN=${{ secrets.HF_TOKEN }}