From b0dbd672b980d5d47d7957fdb10dd76dd66f053c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Thu, 24 May 2018 21:07:19 +0200 Subject: [PATCH] Implement script to start container with pwd mounted on it --- debian-here.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 debian-here.sh diff --git a/debian-here.sh b/debian-here.sh new file mode 100755 index 0000000..5a56a30 --- /dev/null +++ b/debian-here.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +set -eu +set -o pipefail +set -o errtrace +shopt -s expand_aliases + +pushd() { command pushd "$@" > /dev/null; } +popd() { command popd "$@" > /dev/null; } + +here="$(pwd)" +script_dir="$(dirname "$(readlink -f "$0")")" + + +run() { + if [[ ! -z ${BUILD:-} ]];then + pushd "$script_dir" + docker build -t debian-here . + popd + fi + + mount_point="/mnt/$(basename "$here")" + docker run --rm -ti -v "$here":"$mount_point" -w "$mount_point" debian-here /bin/zsh +} + +run