2021-06-07 05:35:42 +00:00
|
|
|
#!/usr/bin/env bash
|
2021-06-08 18:25:13 +00:00
|
|
|
|
2021-06-07 05:35:42 +00:00
|
|
|
set -e
|
2021-06-08 18:25:13 +00:00
|
|
|
|
2021-06-07 05:35:42 +00:00
|
|
|
function clean() {
|
|
|
|
docker rmi $(cat $iidfile)
|
|
|
|
}
|
2021-06-08 18:25:13 +00:00
|
|
|
|
2021-06-07 05:35:42 +00:00
|
|
|
iidfile=$(mktemp -t docker-iidfile.XXXXXXXXXX)
|
|
|
|
DOCKER_BUILDKIT=1 docker build --iidfile $iidfile --target dev-env .
|
2021-06-08 18:25:13 +00:00
|
|
|
|
2021-06-07 05:35:42 +00:00
|
|
|
trap clean EXIT
|
|
|
|
SSH=
|
|
|
|
if [ -n "$MOUNT_SSH_AUTH_SOCK" ]; then
|
|
|
|
SSH="-v $SSH_AUTH_SOCK:$SSH_AUTH_SOCK -e SSH_AUTH_SOCK"
|
|
|
|
fi
|
2021-09-07 22:47:54 +00:00
|
|
|
|
|
|
|
volumes=
|
|
|
|
if [ -n "$MOUNT_BUILDKIT_SOURCE" ]; then
|
|
|
|
volumes="-v $(pwd):/src"
|
|
|
|
fi
|
|
|
|
|
|
|
|
set -x
|
|
|
|
docker run $SSH $volumes -it --privileged -v /tmp --net=host -e BUILDKIT_REGISTRY_MIRROR_DIR=/root/.cache/registry --rm $(cat $iidfile)
|