Make image name overrideable

This commit is contained in:
Kristóf Tóth 2018-05-24 23:17:00 +02:00
parent 82783114fb
commit 1c197db45b

View File

@ -12,17 +12,19 @@ popd() { command popd "$@" > /dev/null; }
here="$(pwd)"
script_dir="$(dirname "$(readlink -f "$0")")"
IMAGE="${IMAGE:-debian-here}"
run() {
if [[ ! -z "${BUILD:-}" ]];then
pushd "$script_dir"
docker build -t debian-here .
docker build -t "$IMAGE" .
popd
exit
fi
mount_point="/mnt/$(basename "$here")"
docker run --rm -ti -v "$here":"$mount_point" -w "$mount_point" ${ARGS:-} debian-here "$@"
docker run --rm -ti -v "$here":"$mount_point" -w "$mount_point" ${ARGS:-} "$IMAGE" "$@"
}
run "$@"