Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 14 additions & 22 deletions .azure-pipelines/docker-image-refresh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ parameters:

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

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

# Build server-side with ACR Tasks: no local Docker daemon, no buildx/QEMU, and no
# Docker Hub dependency (which the network-isolated 1ES pool can't reach). ACR pulls the
# base image from MCR and pushes the result back to the registry.
- task: AzureCLI@2
displayName: 'Log in to Azure Container Registry'
displayName: 'Build and push patched image (ACR Tasks)'
inputs:
azureSubscription: 'ACR Images Push Service Connection'
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: |
az acr login --name $(REGISTRY)

- script: |
docker run --privileged --rm tonistiigi/binfmt --install all
displayName: 'Enable multi-platform builds'

- script: |
docker buildx create --use --name refreshbuilder
displayName: 'Set up Docker BuildX'

- bash: |
set -euo pipefail
formatted_date=$(date +"%Y%m%d%H%M%S")
echo "Rebuilding $(REGISTRY)/$(IMAGE_NAME) on a patched base"
docker buildx build \
--platform linux/amd64 \
--push \
-t "$(REGISTRY)/$(IMAGE_NAME):latest" \
-t "$(REGISTRY)/$(IMAGE_NAME):$formatted_date" \
"$(Build.SourcesDirectory)"
displayName: 'Build and push refreshed image'
set -euo pipefail
formatted_date=$(date +"%Y%m%d%H%M%S")
echo "Rebuilding $(REGISTRY_NAME) / $(IMAGE_NAME) on a patched base via ACR Tasks"
az acr build \
--registry $(REGISTRY_NAME) \
--image "$(IMAGE_NAME):latest" \
--image "$(IMAGE_NAME):$formatted_date" \
--platform linux/amd64 \
"$(Build.SourcesDirectory)"
Loading