1- name : Docker Build Job
1+ name : Build & Push Test Images (Feature Branch)
22
33on :
44 workflow_call :
5- inputs :
6- trigger_type :
7- description : ' Trigger type (workflow_dispatch, pull_request, schedule)'
8- required : true
9- type : string
10- build_docker_image :
11- description : ' Build And Push Docker Image (Optional)'
12- required : false
13- default : false
14- type : boolean
155 outputs :
166 IMAGE_TAG :
177 description : " Generated Docker Image Tag"
188 value : ${{ jobs.docker-build.outputs.IMAGE_TAG }}
9+ workflow_dispatch :
10+
11+ permissions :
12+ contents : read
13+ id-token : write
1914
2015env :
2116 BRANCH_NAME : ${{ github.event.workflow_run.head_branch || github.head_ref || github.ref_name }}
2217
2318jobs :
2419 docker-build :
25- if : inputs.trigger_type == 'workflow_dispatch' && inputs.build_docker_image == true
2620 runs-on : ubuntu-latest
2721 environment : production
2822 outputs :
5650 subscription-id : ${{ secrets.AZURE_SUBSCRIPTION_ID }}
5751
5852 - name : Log in to Azure Container Registry
59- run : az acr login --name ${{ secrets.ACR_TEST_LOGIN_SERVER }}
53+ shell : bash
54+ run : |
55+ # Extract registry name from login server (e.g., myacr.azurecr.io -> myacr)
56+ ACR_NAME=$(echo "${{ vars.ACR_TEST_LOGIN_SERVER }}" | cut -d'.' -f1)
57+ az acr login --name "$ACR_NAME"
6058
6159 - name : Build and Push ContentProcessor Docker image
6260 uses : docker/build-push-action@v7
6765 file : ./src/ContentProcessor/Dockerfile
6866 push : true
6967 tags : |
70- ${{ secrets .ACR_TEST_LOGIN_SERVER }}/contentprocessor:${{ steps.generate_docker_tag.outputs.IMAGE_TAG }}
71- ${{ secrets .ACR_TEST_LOGIN_SERVER }}/contentprocessor:${{ steps.generate_docker_tag.outputs.IMAGE_TAG }}_${{ github.run_number }}
68+ ${{ vars .ACR_TEST_LOGIN_SERVER }}/contentprocessor:${{ steps.generate_docker_tag.outputs.IMAGE_TAG }}
69+ ${{ vars .ACR_TEST_LOGIN_SERVER }}/contentprocessor:${{ steps.generate_docker_tag.outputs.IMAGE_TAG }}_${{ github.run_number }}
7270
7371 - name : Build and Push ContentProcessorAPI Docker image
7472 uses : docker/build-push-action@v7
7977 file : ./src/ContentProcessorAPI/Dockerfile
8078 push : true
8179 tags : |
82- ${{ secrets .ACR_TEST_LOGIN_SERVER }}/contentprocessorapi:${{ steps.generate_docker_tag.outputs.IMAGE_TAG }}
83- ${{ secrets .ACR_TEST_LOGIN_SERVER }}/contentprocessorapi:${{ steps.generate_docker_tag.outputs.IMAGE_TAG }}_${{ github.run_number }}
80+ ${{ vars .ACR_TEST_LOGIN_SERVER }}/contentprocessorapi:${{ steps.generate_docker_tag.outputs.IMAGE_TAG }}
81+ ${{ vars .ACR_TEST_LOGIN_SERVER }}/contentprocessorapi:${{ steps.generate_docker_tag.outputs.IMAGE_TAG }}_${{ github.run_number }}
8482
8583 - name : Build and Push ContentProcessorWeb Docker image
8684 uses : docker/build-push-action@v7
9189 file : ./src/ContentProcessorWeb/Dockerfile
9290 push : true
9391 tags : |
94- ${{ secrets .ACR_TEST_LOGIN_SERVER }}/contentprocessorweb:${{ steps.generate_docker_tag.outputs.IMAGE_TAG }}
95- ${{ secrets .ACR_TEST_LOGIN_SERVER }}/contentprocessorweb:${{ steps.generate_docker_tag.outputs.IMAGE_TAG }}_${{ github.run_number }}
92+ ${{ vars .ACR_TEST_LOGIN_SERVER }}/contentprocessorweb:${{ steps.generate_docker_tag.outputs.IMAGE_TAG }}
93+ ${{ vars .ACR_TEST_LOGIN_SERVER }}/contentprocessorweb:${{ steps.generate_docker_tag.outputs.IMAGE_TAG }}_${{ github.run_number }}
9694
9795 - name : Build and Push ContentProcessorWorkflow Docker image
9896 uses : docker/build-push-action@v6
@@ -103,8 +101,8 @@ jobs:
103101 file : ./src/ContentProcessorWorkflow/Dockerfile
104102 push : true
105103 tags : |
106- ${{ secrets .ACR_TEST_LOGIN_SERVER }}/contentprocessorworkflow:${{ steps.generate_docker_tag.outputs.IMAGE_TAG }}
107- ${{ secrets .ACR_TEST_LOGIN_SERVER }}/contentprocessorworkflow:${{ steps.generate_docker_tag.outputs.IMAGE_TAG }}_${{ github.run_number }}
104+ ${{ vars .ACR_TEST_LOGIN_SERVER }}/contentprocessorworkflow:${{ steps.generate_docker_tag.outputs.IMAGE_TAG }}
105+ ${{ vars .ACR_TEST_LOGIN_SERVER }}/contentprocessorworkflow:${{ steps.generate_docker_tag.outputs.IMAGE_TAG }}_${{ github.run_number }}
108106
109107 - name : Verify Docker Image Build
110108 shell : bash
@@ -116,7 +114,7 @@ jobs:
116114 if : always()
117115 shell : bash
118116 run : |
119- ACR_NAME=$(echo "${{ secrets .ACR_TEST_LOGIN_SERVER }}")
117+ ACR_NAME=$(echo "${{ vars .ACR_TEST_LOGIN_SERVER }}")
120118 echo "## 🐳 Docker Build Job Summary" >> $GITHUB_STEP_SUMMARY
121119 echo "" >> $GITHUB_STEP_SUMMARY
122120 echo "| Field | Value |" >> $GITHUB_STEP_SUMMARY
0 commit comments