mirror of https://github.com/linkerd/linkerd2.git
Add docker builder option to improve build tooling (#10935)
This adds the ability to pass in a docker builder option to docker. This makes building multi-arch images super simple by using our k8s infrastructure. It also makes building multi-arch images very fast since they can be built in parallel and on native hardware. DCO Sign off I agree to the DCO for all the commits in this PR. Co-authored-by: Alejandro Pedraza <alejandro.pedraza@gmail.com>
This commit is contained in:
parent
53ec66a434
commit
478da8b644
|
|
@ -23,6 +23,8 @@ export DOCKER_TARGET=${DOCKER_TARGET:-$(os)}
|
|||
# When set together with DOCKER_TARGET=multi-arch, it will push the multi-arch images to the registry
|
||||
export DOCKER_PUSH=${DOCKER_PUSH:-}
|
||||
|
||||
export DOCKER_BUILDER=${DOCKER_BUILDER:-}
|
||||
|
||||
# Default supported docker image architectures
|
||||
export SUPPORTED_ARCHS=${SUPPORTED_ARCHS:-linux/amd64,linux/arm64,linux/arm/v7}
|
||||
|
||||
|
|
@ -82,6 +84,13 @@ See https://github.com/docker/buildx/issues/59 for more details'
|
|||
fi
|
||||
fi
|
||||
|
||||
# Allow for specifying docker builder engine
|
||||
# This is a great way to use k8s to build docker images on native hardware instead of emulated
|
||||
# See https://docs.docker.com/build/drivers/kubernetes/ for an example
|
||||
if [ "$DOCKER_BUILDER" ]; then
|
||||
output_params+=" --builder=$DOCKER_BUILDER"
|
||||
fi
|
||||
|
||||
log_debug " :; docker buildx $rootdir $cache_params $output_params -t $repo:$tag -f $file $*"
|
||||
# shellcheck disable=SC2086
|
||||
docker buildx build "$rootdir" $cache_params \
|
||||
|
|
|
|||
Loading…
Reference in New Issue