Files
buildkit/hack/shell
Tonis Tiigi 33088c1a56 hack: allow passing config file to test and shell script
One should not use their regular docker credentials here
but make a special config file with only public readonly
token inside.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2025-01-30 19:00:29 -08:00

32 lines
776 B
Bash
Executable File

#!/usr/bin/env bash
set -e
function clean() {
docker rmi $(cat $iidfile)
}
iidfile=$(mktemp -t docker-iidfile.XXXXXXXXXX)
DOCKER_BUILDKIT=1 docker build --iidfile $iidfile --build-arg BUILDKIT_DEBUG --target dev-env .
trap clean EXIT
SSH=
if [ -n "$MOUNT_SSH_AUTH_SOCK" ]; then
SSH="-v $SSH_AUTH_SOCK:$SSH_AUTH_SOCK -e SSH_AUTH_SOCK"
fi
volumes=
if [ -n "$MOUNT_BUILDKIT_SOURCE" ]; then
volumes="-v $(pwd):/src"
fi
config=
if [ -n "$MOUNT_BUILDKIT_DOCKER_CONFIG_PATH" ]; then
if [ -f "$MOUNT_BUILDKIT_DOCKER_CONFIG_PATH" ]; then
config="-v $MOUNT_BUILDKIT_DOCKER_CONFIG_PATH:/root/.docker/config.json:ro"
fi
fi
set -x
docker run $SSH $volumes $config -it --privileged -v /tmp -e BUILDKIT_REGISTRY_MIRROR_DIR=/root/.cache/registry --rm $(cat $iidfile) ash