Skip to content

updated the warm up model code to make sure the first doesnt make the… #7

updated the warm up model code to make sure the first doesnt make the…

updated the warm up model code to make sure the first doesnt make the… #7

name: Deploy Backend
on:
push:
branches:
- main
paths:
- "backend/**"
- ".github/workflows/deploy-backend.yml"
permissions:
id-token: write
contents: read
env:
REGISTRY: lipyacr.azurecr.io
REGISTRY_NAME: lipyacr
IMAGE_NAME: lipy-backend
CONTAINER_APP: lipy-api
RESOURCE_GROUP: lipy-rg
jobs:
deploy:
runs-on: ubuntu-latest
defaults:
run:
working-directory: backend
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Azure Login (OIDC)
uses: azure/login@v2
with:
client-id: ${{ vars.AZURE_CLIENT_ID }}
tenant-id: ${{ vars.AZURE_TENANT_ID }}
subscription-id: ${{ vars.AZURE_SUBSCRIPTION_ID }}
- name: Login to Azure Container Registry
run: |
az acr login --name $REGISTRY_NAME
- name: Build Docker image
run: |
docker build \
-t $REGISTRY/$IMAGE_NAME:${{ github.sha }} \
-t $REGISTRY/$IMAGE_NAME:latest \
.
- name: Push Docker image
run: |
docker push $REGISTRY/$IMAGE_NAME:${{ github.sha }}
docker push $REGISTRY/$IMAGE_NAME:latest
- name: Update Container App
run: |
az containerapp update \
--name $CONTAINER_APP \
--resource-group $RESOURCE_GROUP \
--image $REGISTRY/$IMAGE_NAME:${{ github.sha }}
- name: Wait for deployment
run: sleep 20
- name: Show latest revision
run: |
az containerapp revision list \
--name $CONTAINER_APP \
--resource-group $RESOURCE_GROUP \
--output table
- name: Verify application
run: |
APP_URL=$(az containerapp show \
--name $CONTAINER_APP \
--resource-group $RESOURCE_GROUP \
--query properties.configuration.ingress.fqdn \
-o tsv)
curl --fail --retry 10 --retry-delay 5 \
"https://$APP_URL/"