From 6e189ff2bea8931738f31750add972f2fd0e71b1 Mon Sep 17 00:00:00 2001 From: Graham Whaley Date: Thu, 22 Aug 2019 15:57:10 +0100 Subject: [PATCH] metrics: report: mount scripts in debug mode When in debug mode, mount the scripts dir into the container to allow 'live' editing and reloading into R. This makes the dev cycle much faster. Signed-off-by: Graham Whaley --- metrics/report/makereport.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/metrics/report/makereport.sh b/metrics/report/makereport.sh index 7338c71..962be76 100755 --- a/metrics/report/makereport.sh +++ b/metrics/report/makereport.sh @@ -22,6 +22,11 @@ HOSTOUTPUTDIR="${SCRIPT_PATH}/output" GUESTINPUTDIR="/inputdir/" GUESTOUTPUTDIR="/outputdir/" +# If in debugging mode, we also map in the scripts dir so you can +# dynamically edit and re-load them at the R prompt +HOSTSCRIPTDIR="${SCRIPT_PATH}/report_dockerfile" +GUESTSCRIPTDIR="/scripts/" + # This function performs a docker build on the image names # passed in, to ensure that we have the latest changes from # the dockerfiles @@ -95,7 +100,7 @@ setup() { } run() { - docker run -ti --rm -v ${HOSTINPUTDIR}:${GUESTINPUTDIR} -v ${HOSTOUTPUTDIR}:${GUESTOUTPUTDIR} ${IMAGE} ${extra_command} + docker run -ti --rm -v ${HOSTINPUTDIR}:${GUESTINPUTDIR} -v ${HOSTOUTPUTDIR}:${GUESTOUTPUTDIR} ${extra_volumes} ${IMAGE} ${extra_command} ls -la ${HOSTOUTPUTDIR}/* } @@ -107,6 +112,7 @@ main() { d) # In debug mode, run a shell instead of the default report generation extra_command="bash" + extra_volumes="-v ${HOSTSCRIPTDIR}:${GUESTSCRIPTDIR}" ;; esac done