Spaces:
Sleeping
Sleeping
Create Azure_CICD.yml
Browse files
.github/workflows/Azure_CICD.yml
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Build & Deploy to Azure Container Apps
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
push:
|
| 5 |
+
branches:
|
| 6 |
+
- main
|
| 7 |
+
|
| 8 |
+
jobs:
|
| 9 |
+
build-and-deploy:
|
| 10 |
+
runs-on: ubuntu-latest
|
| 11 |
+
|
| 12 |
+
steps:
|
| 13 |
+
- name: Checkout repository
|
| 14 |
+
uses: actions/checkout@v3
|
| 15 |
+
|
| 16 |
+
- name: Azure Login
|
| 17 |
+
uses: azure/login@v1
|
| 18 |
+
with:
|
| 19 |
+
creds: ${{ secrets.AZURE_CREDENTIALS }}
|
| 20 |
+
|
| 21 |
+
- name: Build Docker image
|
| 22 |
+
run: |
|
| 23 |
+
docker build -t ${{ secrets.ACR_LOGIN_SERVER }}/translator-app:latest .
|
| 24 |
+
|
| 25 |
+
- name: Login to Azure Container Registry
|
| 26 |
+
run: |
|
| 27 |
+
az acr login --name ${{ secrets.ACR_NAME }}
|
| 28 |
+
|
| 29 |
+
- name: Push Docker image to ACR
|
| 30 |
+
run: |
|
| 31 |
+
docker push ${{ secrets.ACR_LOGIN_SERVER }}/translator-app:latest
|
| 32 |
+
|
| 33 |
+
- name: Deploy updated image to Azure Container App
|
| 34 |
+
run: |
|
| 35 |
+
az containerapp update \
|
| 36 |
+
--name ${{ secrets.CONTAINER_APP_NAME }} \
|
| 37 |
+
--resource-group ${{ secrets.RESOURCE_GROUP }} \
|
| 38 |
+
--image ${{ secrets.ACR_LOGIN_SERVER }}/translator-app:latest \
|
| 39 |
+
--env-vars HF_TOKEN=${{ secrets.HF_TOKEN }}
|