buildx/hack/shell

20 lines
400 B
Bash
Executable File

#!/usr/bin/env bash
set -e
: "${BUILDX_CMD=docker buildx}"
: "${TMUX=}"
function clean {
docker rmi $iid
}
iid=buildx-shell
(set -x ; ${BUILDX_CMD} build --output "type=docker,name=$iid" --target shell .)
trap clean EXIT
SSH=
if [ -n "$MOUNT_SSH_AUTH_SOCK" ]; then
SSH="-v $SSH_AUTH_SOCK:$SSH_AUTH_SOCK -e SSH_AUTH_SOCK"
fi
docker run $SSH -it --privileged --rm -e TMUX_ENTRYPOINT=$TMUX $iid