https://github.com/rstropek/rust-request-bin
# Create Azure Container Registry
# Assumption: Name of ACR is acrbeyondimages
# Setup webhook to https://acr-beyond-images.azurewebsites.net/bin
docker pull alpine:latest
docker pull rust:alpine
docker tag alpine:latest acrbeyondimages.azurecr.io/alpine:latest
docker tag rust:alpine acrbeyondimages.azurecr.io/rust:alpine
docker push acrbeyondimages.azurecr.io/alpine:latest
docker push acrbeyondimages.azurecr.io/rust:alpine
# Show webhook call
# Show webhook log in portal
# Ping webhook interactively
Replace docker build with az acr build
Runs your build task in Azure instead of on your computer
Build context is automatically sent to ACR
No need to change Dockerfile
Pushes resulting image automatically in ACR
Note: Set default registry with az config set defaults.acr=myregistry
# Usual command:
docker build \
--build-arg BASE=acrbeyondimages.azurecr.io/rust:alpine \
-t acrbeyondimages.azurecr.io/request-bin \
.
# ACR Quick Task:
az acr build \
--registry acrbeyondimages \
--build-arg BASE=acrbeyondimages.azurecr.io/rust:alpine \
-t acrbeyondimages.azurecr.io/request-bin \
.
Examples:
Manually triggered ("quick tasks")
Source code update (Github/Azure DevOps webhooks)
βNeeds PAT for setting-up webhook
Base image update
βBase images from ACRs, Docker Hub, publish MS registries
Note: No running of tasks on updates of intermediate images
(e.g. build steps in multi-stage Dockerfiles)
Note: Consider importing base images from Docker Hub into ACR
(az acr import) and use them as base images
Schedule
# Run quicktask
just build-image-acr-cloud
# Create ACR Task
az acr task create \
--registry acrbeyondimages \
--name request-bin-gh \
--image request-bin-gh:{{.Run.ID}} \
--context https://github.com/rstropek/rust-request-bin.git#main \
--file Dockerfile \
--git-access-token $GIT_PAT