@@ -56,46 +56,32 @@ jobs:
5656 echo "DATE_TAG=${DATE_TAG}" >> $GITHUB_ENV
5757 echo "Base tag: $BASE_TAG, Date tag: $DATE_TAG"
5858
59- - name : Build and push ContentProcessor Docker image
60- run : |
61- cd src/ContentProcessor
62- IMAGE_NAME="$ACR_LOGIN_SERVER/contentprocessor"
63- echo "Using image name: ${IMAGE_NAME}"
64- # Build image with two tags: one base and one with date
65- docker build -t ${IMAGE_NAME}:${BASE_TAG} -t ${IMAGE_NAME}:${DATE_TAG} -f Dockerfile .
66- # Push both tags if the base tag is valid
67- if [[ "${BASE_TAG}" == "latest" || "${BASE_TAG}" == "dev" || "${BASE_TAG}" == "demo" || "${BASE_TAG}" == "hotfix" ]]; then
68- docker push ${IMAGE_NAME}:${BASE_TAG}
69- docker push ${IMAGE_NAME}:${DATE_TAG}
70- echo "ContentProcessor image built and pushed successfully."
71- else
72- echo "Skipping Docker push for ContentProcessor with tag: ${BASE_TAG}"
73- fi
59+ - name : Build and Push ContentProcessor Docker image
60+ uses : docker/build-push-action@v6
61+ with :
62+ context : ./src/ContentProcessor
63+ file : ./src/ContentProcessor/Dockerfile
64+ push : ${{ github.ref_name == 'main' || github.ref_name == 'dev' || github.ref_name == 'demo' || github.ref_name == 'hotfix' }}
65+ tags : |
66+ ${{ env.ACR_LOGIN_SERVER }}/contentprocessor:${{ env.BASE_TAG }}
67+ ${{ env.ACR_LOGIN_SERVER }}/contentprocessor:${{ env.DATE_TAG }}
7468
75- - name : Build and push ContentProcessorAPI Docker image
76- run : |
77- cd src/ContentProcessorAPI
78- IMAGE_NAME="$ACR_LOGIN_SERVER/contentprocessorapi"
79- echo "Using image name: ${IMAGE_NAME}"
80- docker build -t ${IMAGE_NAME}:${BASE_TAG} -t ${IMAGE_NAME}:${DATE_TAG} -f Dockerfile .
81- if [[ "${BASE_TAG}" == "latest" || "${BASE_TAG}" == "dev" || "${BASE_TAG}" == "demo" || "${BASE_TAG}" == "hotfix" ]]; then
82- docker push ${IMAGE_NAME}:${BASE_TAG}
83- docker push ${IMAGE_NAME}:${DATE_TAG}
84- echo "ContentProcessorAPI image built and pushed successfully."
85- else
86- echo "Skipping Docker push for ContentProcessorAPI with tag: ${BASE_TAG}"
87- fi
69+ - name : Build and Push ContentProcessorAPI Docker image
70+ uses : docker/build-push-action@v6
71+ with :
72+ context : ./src/ContentProcessorAPI
73+ file : ./src/ContentProcessorAPI/Dockerfile
74+ push : ${{ github.ref_name == 'main' || github.ref_name == 'dev' || github.ref_name == 'demo' || github.ref_name == 'hotfix' }}
75+ tags : |
76+ ${{ env.ACR_LOGIN_SERVER }}/contentprocessorapi:${{ env.BASE_TAG }}
77+ ${{ env.ACR_LOGIN_SERVER }}/contentprocessorapi:${{ env.DATE_TAG }}
8878
89- - name : Build and push ContentProcessorWeb Docker image
90- run : |
91- cd src/ContentProcessorWeb
92- IMAGE_NAME="$ACR_LOGIN_SERVER/contentprocessorweb"
93- echo "Using image name: ${IMAGE_NAME}"
94- docker build -t ${IMAGE_NAME}:${BASE_TAG} -t ${IMAGE_NAME}:${DATE_TAG} -f Dockerfile .
95- if [[ "${BASE_TAG}" == "latest" || "${BASE_TAG}" == "dev" || "${BASE_TAG}" == "demo" || "${BASE_TAG}" == "hotfix" ]]; then
96- docker push ${IMAGE_NAME}:${BASE_TAG}
97- docker push ${IMAGE_NAME}:${DATE_TAG}
98- echo "ContentProcessorWeb image built and pushed successfully."
99- else
100- echo "Skipping Docker push for ContentProcessorWeb with tag: ${BASE_TAG}"
101- fi
79+ - name : Build and Push ContentProcessorWeb Docker image
80+ uses : docker/build-push-action@v6
81+ with :
82+ context : ./src/ContentProcessorWeb
83+ file : ./src/ContentProcessorWeb/Dockerfile
84+ push : ${{ github.ref_name == 'main' || github.ref_name == 'dev' || github.ref_name == 'demo' || github.ref_name == 'hotfix' }}
85+ tags : |
86+ ${{ env.ACR_LOGIN_SERVER }}/contentprocessorweb:${{ env.BASE_TAG }}
87+ ${{ env.ACR_LOGIN_SERVER }}/contentprocessorweb:${{ env.DATE_TAG }}
0 commit comments