CD Pipeline #29
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
| name: CD Pipeline | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| env: | |
| ACR_NAME: flowopsacr2025.azurecr.io | |
| BACKEND_IMAGE: flowopsacr2025.azurecr.io/flowops-backend | |
| FRONTEND_IMAGE: flowopsacr2025.azurecr.io/flowops-frontend | |
| BACKEND_URL: https://flowops-backend-app.azurewebsites.net | |
| jobs: | |
| build-and-deploy: | |
| name: Build and Deploy Docker Images | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to Azure Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.ACR_NAME }} | |
| username: ${{ secrets.ACR_USERNAME }} | |
| password: ${{ secrets.ACR_PASSWORD }} | |
| # Build and push Backend Docker image | |
| - name: Build and Push Backend | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: ./backend | |
| push: true | |
| tags: | | |
| ${{ env.BACKEND_IMAGE }}:${{ github.sha }} | |
| ${{ env.BACKEND_IMAGE }}:latest | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| # Build and push Frontend Docker image with API URL | |
| - name: Build and Push Frontend | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: ./frontend | |
| push: true | |
| tags: | | |
| ${{ env.FRONTEND_IMAGE }}:${{ github.sha }} | |
| ${{ env.FRONTEND_IMAGE }}:latest | |
| build-args: | | |
| VITE_API_URL=${{ env.BACKEND_URL }}/api | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| # Deploy Backend container to Azure App Service | |
| - name: Deploy Backend to Azure | |
| uses: azure/webapps-deploy@v3 | |
| with: | |
| app-name: flowops-backend-app | |
| publish-profile: ${{ secrets.AZURE_BACKEND_PUBLISH_PROFILE }} | |
| images: ${{ env.BACKEND_IMAGE }}:${{ github.sha }} | |
| # Deploy Frontend container to Azure App Service | |
| - name: Deploy Frontend to Azure | |
| uses: azure/webapps-deploy@v3 | |
| with: | |
| app-name: flowops-frontend-app | |
| publish-profile: ${{ secrets.AZURE_FRONTEND_PUBLISH_PROFILE }} | |
| images: ${{ env.FRONTEND_IMAGE }}:${{ github.sha }} |