ci workflow #4 #4
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 Docker Image | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Log in to Azure | |
uses: azure/login@v1 | |
with: | |
client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
client-secret: ${{ secrets.AZURE_CLIENT_SECRET }} | |
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
- name: Log in to ACR | |
run: | | |
az acr login --name ${{ secrets.ACR_NAME }} | |
- name: Build Docker image | |
run: | | |
docker build -t ${{ secrets.ACR_NAME }}.azurecr.io/todo-app-img:latest todo-app/ | |
- name: Push Docker image to ACR | |
run: | | |
docker push ${{ secrets.ACR_NAME }}.azurecr.io/todo-app-img:latest |