-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Description
Describe the bug
I am using az acr build in a GitHub Actions workflow to build and push a Docker image to Azure Container Registry (ACR).
The following command works fine:
az acr build --image ${{ env.AZURE_CONTAINER_REGISTRY }}.azurecr.io/${{ env.CONTAINER_NAME }}:${{ github.sha }} \
--registry ${{ env.AZURE_CONTAINER_REGISTRY }} \
-g ${{ env.ACR_RESOURCE_GROUP }} \
-f ${{ env.DOCKER_FILE }} \
${{ env.BUILD_CONTEXT_PATH }}Related command
But this command gives us the error as shown in the screenshot
az acr build --image ${{ env.AZURE_CONTAINER_REGISTRY }}.azurecr.io/${{ env.CONTAINER_NAME }}:${{ github.sha }} \
--registry ${{ env.AZURE_CONTAINER_REGISTRY }} \
-g ${{ env.ACR_RESOURCE_GROUP }} \
-f ${{ env.DOCKER_FILE }} \
--build-arg AZURE_COMMUNICATION_SERVICES_CONNECTION_STRING=${{ secrets.AZURE_COMMUNICATION_SERVICES_CONNECTION_STRING }} \
--build-arg AZURE_COMMUNICATION_SENDER_EMAIL=${{ secrets.AZURE_COMMUNICATION_SENDER_EMAIL }} \
--build-arg AZURE_COMMUNICATION_RECIPIENT_EMAIL=${{ secrets.AZURE_COMMUNICATION_RECIPIENT_EMAIL }} \
${{ env.BUILD_CONTEXT_PATH }}Errors
However, when I add --build-arg options, the command fails with the error:
"the following arguments are required: <SOURCE_LOCATION>"
Expected behavior
Both versions of the command should work as expected. Adding --build-arg should not break the az acr build command.
Actual Behavior:
Adding --build-arg results in the following error:
ERROR: the following arguments are required: <SOURCE_LOCATION>
Additional context
I confirmed that the Dockerfile and build context exist
The same command works locally, but fails in GitHub Actions
Possible issue with how az acr build handles --build-arg in GitHub Actions?
