Skip to content

Commit 6028659

Browse files
gavinbarronCopilot
andauthored
Build docker-image-refresh via ACR Tasks (az acr build) to avoid Docker Hub (#3671)
On the network-isolated 1ES pool the agent cannot reach registry-1.docker.io, so 'docker run tonistiigi/binfmt' and 'docker buildx create' (which pull moby/buildkit) fail with a connection timeout. Replace the local docker/buildx path with a server-side 'az acr build': ACR pulls the base from MCR and pushes the result, with no local Docker daemon, no QEMU/binfmt, and no Docker Hub dependency. Copilot-Session: d3f8fec7-b00b-46be-ba39-7e1f3e7f7188 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 3b89652 commit 6028659

1 file changed

Lines changed: 14 additions & 22 deletions

File tree

.azure-pipelines/docker-image-refresh.yml

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ parameters:
2424

2525
variables:
2626
REGISTRY: 'msgraphprodregistry.azurecr.io'
27+
REGISTRY_NAME: 'msgraphprodregistry' # ACR resource name (az acr build uses this, not the FQDN)
2728
IMAGE_NAME: 'public/microsoftgraph/powershell'
2829

2930
# Rebuild weekly so the image regularly picks up patched OS layers. `always: true` forces a run
@@ -71,31 +72,22 @@ extends:
7172
steps:
7273
- checkout: self
7374

75+
# Build server-side with ACR Tasks: no local Docker daemon, no buildx/QEMU, and no
76+
# Docker Hub dependency (which the network-isolated 1ES pool can't reach). ACR pulls the
77+
# base image from MCR and pushes the result back to the registry.
7478
- task: AzureCLI@2
75-
displayName: 'Log in to Azure Container Registry'
79+
displayName: 'Build and push patched image (ACR Tasks)'
7680
inputs:
7781
azureSubscription: 'ACR Images Push Service Connection'
7882
scriptType: 'bash'
7983
scriptLocation: 'inlineScript'
8084
inlineScript: |
81-
az acr login --name $(REGISTRY)
82-
83-
- script: |
84-
docker run --privileged --rm tonistiigi/binfmt --install all
85-
displayName: 'Enable multi-platform builds'
86-
87-
- script: |
88-
docker buildx create --use --name refreshbuilder
89-
displayName: 'Set up Docker BuildX'
90-
91-
- bash: |
92-
set -euo pipefail
93-
formatted_date=$(date +"%Y%m%d%H%M%S")
94-
echo "Rebuilding $(REGISTRY)/$(IMAGE_NAME) on a patched base"
95-
docker buildx build \
96-
--platform linux/amd64 \
97-
--push \
98-
-t "$(REGISTRY)/$(IMAGE_NAME):latest" \
99-
-t "$(REGISTRY)/$(IMAGE_NAME):$formatted_date" \
100-
"$(Build.SourcesDirectory)"
101-
displayName: 'Build and push refreshed image'
85+
set -euo pipefail
86+
formatted_date=$(date +"%Y%m%d%H%M%S")
87+
echo "Rebuilding $(REGISTRY_NAME) / $(IMAGE_NAME) on a patched base via ACR Tasks"
88+
az acr build \
89+
--registry $(REGISTRY_NAME) \
90+
--image "$(IMAGE_NAME):latest" \
91+
--image "$(IMAGE_NAME):$formatted_date" \
92+
--platform linux/amd64 \
93+
"$(Build.SourcesDirectory)"

0 commit comments

Comments
 (0)