File tree Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Build and Push PHP Parser to ACR
2+
3+ on :
4+ push :
5+ branches : ["main"]
6+ workflow_dispatch :
7+
8+ env :
9+ AZURE_CONTAINER_REGISTRY : " prodsnorkellacr"
10+ CONTAINER_NAME : " php-parser"
11+ RESOURCE_GROUP : " prod-snorkell-backend-rg"
12+
13+ jobs :
14+ build-and-push :
15+ permissions :
16+ contents : read
17+ id-token : write
18+ runs-on : ubuntu-latest
19+ steps :
20+ - uses : actions/checkout@v3
21+
22+ - name : Azure Login
23+ uses : azure/login@v1.4.6
24+ with :
25+ client-id : ${{ secrets.AZURE_CLIENT_ID }}
26+ tenant-id : ${{ secrets.AZURE_TENANT_ID }}
27+ subscription-id : ${{ secrets.AZURE_SUBSCRIPTION_ID }}
28+
29+ - name : Get ACR Credentials
30+ run : |
31+ az acr update -n ${{ env.AZURE_CONTAINER_REGISTRY }} -g ${{ env.RESOURCE_GROUP }} --admin-enabled true
32+ ACR_USERNAME=$(az acr credential show -g ${{ env.RESOURCE_GROUP }} -n ${{ env.AZURE_CONTAINER_REGISTRY }} --query username -o tsv)
33+ ACR_PASSWORD=$(az acr credential show -g ${{ env.RESOURCE_GROUP }} -n ${{ env.AZURE_CONTAINER_REGISTRY }} --query passwords[0].value -o tsv)
34+ echo "::add-mask::$ACR_PASSWORD"
35+ echo "acr_username=$ACR_USERNAME" >> $GITHUB_ENV
36+ echo "acr_password=$ACR_PASSWORD" >> $GITHUB_ENV
37+ id : get-acr-creds
38+
39+ - uses : azure/docker-login@v1
40+ with :
41+ login-server : ${{ env.AZURE_CONTAINER_REGISTRY }}.azurecr.io
42+ username : ${{ env.acr_username }}
43+ password : ${{ env.acr_password }}
44+
45+ - name : Build and Push Docker Image
46+ run : |
47+ docker build . -f Dockerfile -t ${{ env.AZURE_CONTAINER_REGISTRY }}.azurecr.io/${{ env.CONTAINER_NAME }}:latest
48+ docker push ${{ env.AZURE_CONTAINER_REGISTRY }}.azurecr.io/${{ env.CONTAINER_NAME }}:latest
You can’t perform that action at this time.
0 commit comments