Update README.md #23
This file contains 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 to ACR | |
on: | |
push: | |
branches: | |
- master | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checkout code | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
# Step 2: Log in to Azure CLI with OpenID Connect (OIDC) | |
- name: Log in to Azure CLI | |
uses: azure/login@v1 | |
with: | |
client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
enable-AzPSSession: true | |
# Step 3: Build Docker Image | |
- name: Build Docker image | |
run: | | |
docker build -t order-microservice:latest . | |
# Step 4: Tag Docker Image with ACR URL | |
- name: Tag Docker image | |
run: | | |
docker tag order-microservice:latest classpathio.azurecr.io/order-microservice:latest | |
# Step 5: Login to ACR using Azure CLI | |
- name: Log in to ACR using Azure CLI | |
env: | |
ACR_NAME: "classpathio" # Use your ACR name | |
run: | | |
az acr login --name $ACR_NAME | |
# Step 6: Push Docker Image to ACR | |
- name: Push Docker image to ACR | |
run: | | |
docker push classpathio.azurecr.io/order-microservice:latest |