Skip to content

Commit 1a577bc

Browse files
committed
Update CI/CD workflow to use OIDC for ACR login and streamline Docker image build and push steps
1 parent 64dcc7e commit 1a577bc

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

.github/workflows/cicd.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,15 @@ jobs:
5555
app-name: ${{ env.AZURE_WEBAPP_NAME }} # Replace with your app name
5656
package: "${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/webapp01/bin/publish"
5757

58-
- uses: azure/docker-login@v2
59-
with:
60-
login-server: ${{ env.AZURE_ACR_NAME }}.azurecr.io
61-
username: ${{ secrets.REGISTRY_USERNAME }}
62-
password: ${{ secrets.REGISTRY_PASSWORD }}
63-
- run: |
58+
- name: ACR Login via OIDC
59+
run: az acr login --name ${{ env.AZURE_ACR_NAME }}
60+
61+
- name: Build and Push Docker Image
62+
run: |
6463
docker build ./src/webapp01 --file ./src/webapp01/Dockerfile -t ${{ env.AZURE_ACR_NAME }}.azurecr.io/webapp01:${{ github.sha }}
64+
docker tag ${{ env.AZURE_ACR_NAME }}.azurecr.io/webapp01:${{ github.sha }} ${{ env.AZURE_ACR_NAME }}.azurecr.io/webapp01:latest
6565
docker push ${{ env.AZURE_ACR_NAME }}.azurecr.io/webapp01:${{ github.sha }}
66+
docker push ${{ env.AZURE_ACR_NAME }}.azurecr.io/webapp01:latest
6667
6768
- name: Azure Web Apps Deploy
6869
uses: azure/webapps-deploy@v3
@@ -77,7 +78,6 @@ jobs:
7778
# https://docs.github.com/en/actions/security-for-github-actions/using-artifact-attestations/using-artifact-attestations-and-reusable-workflows-to-achieve-slsa-v1-build-level-3
7879
container-build-publish:
7980
name: Build and Publish Container Image
80-
needs: []
8181
uses: devopsabcs-engineering/devsecops-reusable-workflows/.github/workflows/container.yml@main
8282
with:
8383
# This is used for tagging the container image

0 commit comments

Comments
 (0)