Switch container base image from Fedora 41 to RHEL UBI 9 #10
This file contains hidden or 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
| # CI/CD Pipeline: Build container image and deploy to AKS | |
| # | |
| # Triggers on push to main branch | |
| # 1. Logs into Azure using Service Principal | |
| # 2. Builds container image using ACR Build (cloud-based) | |
| # 3. Updates AKS deployment with new image | |
| # | |
| # Required secrets: | |
| # AZURE_CREDENTIALS - Service Principal JSON from: az ad sp create-for-rbac --sdk-auth | |
| name: Build and Deploy to AKS | |
| on: | |
| push: | |
| branches: [main] | |
| paths-ignore: | |
| - '**.md' | |
| - 'docs/**' | |
| - '.gitignore' | |
| workflow_dispatch: # Allow manual trigger | |
| env: | |
| ACR_NAME: perfratingdemoacr | |
| AKS_CLUSTER: perf-rating-aks | |
| AKS_RESOURCE_GROUP: perf-rating-demo-rg | |
| IMAGE_NAME: performance-rating | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Checkout the code | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| # Login to Azure | |
| - name: Azure Login | |
| uses: azure/login@v2 | |
| with: | |
| creds: ${{ secrets.AZURE_CREDENTIALS }} | |
| # Build image using ACR Build (no local Docker needed) | |
| - name: Build image in ACR | |
| run: | | |
| az acr build \ | |
| --registry ${{ env.ACR_NAME }} \ | |
| --image ${{ env.IMAGE_NAME }}:${{ github.sha }} \ | |
| --image ${{ env.IMAGE_NAME }}:latest \ | |
| . | |
| # Get AKS credentials | |
| - name: Get AKS credentials | |
| run: | | |
| az aks get-credentials \ | |
| --resource-group ${{ env.AKS_RESOURCE_GROUP }} \ | |
| --name ${{ env.AKS_CLUSTER }} \ | |
| --overwrite-existing | |
| # Update deployment with new image | |
| - name: Deploy to AKS | |
| run: | | |
| kubectl set image deployment/perf-rating \ | |
| perf-rating=${{ env.ACR_NAME }}.azurecr.io/${{ env.IMAGE_NAME }}:${{ github.sha }} | |
| # Wait for rollout to complete | |
| kubectl rollout status deployment/perf-rating --timeout=120s | |
| # Show deployment status | |
| - name: Show deployment status | |
| run: | | |
| echo "=== Pods ===" | |
| kubectl get pods -l app=perf-rating | |
| echo "" | |
| echo "=== Service ===" | |
| kubectl get service perf-rating |