Merge pull request #14 from sodalabsab/lab4-load-balancing-and-podman #1
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: Build and push application | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - lab1/** # Triggers the workflow when any file in the lab3 folder is changed | |
| env: | |
| ACR_NAME: ${{ vars.ACR_NAME }} | |
| IMAGE_NAME: scalingcloud | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| contents: read | |
| steps: | |
| # Step 1: Checkout repository | |
| - name: Checkout repository | |
| uses: actions/checkout@v2 | |
| - name: Run setup script | |
| run: | | |
| cd lab1 | |
| chmod +x setup-massively.sh # Ensure the script is executable | |
| ./setup-massively.sh # Execute the script | |
| # Step 2: Log in to Azure | |
| - name: Log in 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 }} | |
| - name: Log in to ACR | |
| run: | | |
| az acr login --name ${{ env.ACR_NAME }} | |
| # Step 3: Build and Push Docker Image | |
| - name: Build and push Docker image | |
| run: | | |
| docker build -t ${{ env.ACR_NAME }}.azurecr.io/${{ env.IMAGE_NAME }}:latest ./lab1 | |
| docker push ${{ env.ACR_NAME }}.azurecr.io/${{ env.IMAGE_NAME }}:latest |