Skip to content

Commit

Permalink
Merge pull request #2 from rappdw/dwr/vcs-integration-notebooks
Browse files Browse the repository at this point in the history
Support capabilities added to rappdw/docker-ds for better vcs integration
  • Loading branch information
rappdw authored Aug 1, 2018
2 parents 4842089 + f77b3bb commit ab8e8a2
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 6 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,12 @@ the docker file to the defined repository (AWS or Docker)

`run-notebook` will start a docker container using either the notebook container found in the `docker/notebook` directory
if it exists, or [rappdw/docker-ds](https://github.com/rappdw/docker-ds) otherwise. The current directory will be mounted
into the container for use in the Juypter notebook environment.
into the container for use in the Juypter notebook environment. There are a couple of environment variable to be aware of
with this command:

* DOCKER_DS_DONT_PULL - if set, the version of rappdw/docker-ds currently available will be used rather than pulling
the latest version from docker hub.
* DOCKER_DS_DIFFS - if set,

## `dockerutils.cfg` Format
Configuration in `docker/dockerutils.cfg` is used to configure behavior of the `dockerutils` scripts.
Expand Down
35 changes: 30 additions & 5 deletions scripts/run-notebook
Original file line number Diff line number Diff line change
@@ -1,22 +1,47 @@
#!/usr/bin/env bash

DOCKER_DS_DONT_PULL=${DOCKER_DS_DONT_PULL:-pull}
DOCKER_DS_DIFFS=${DOCKER_DS_DIFFS:-no_diffs}

DOCKER_ENV=""

if [ "$DOCKER_DS_DIFFS" != "no_diffs" ]; then
DOCKER_ENV="-e DOCKER_DS_DIFFS=1"
fi

if [ -d "./docker/notebook" ]; then
build-image -f notebook
run-image notebook
else
# Script to run rappdw/docker-ds notebok against the current directory
docker pull rappdw/docker-ds:latest
if [ "$DOCKER_DS_DONT_PULL" = "pull" ]; then
docker pull rappdw/docker-ds:latest
fi

date_stamp=$(date "+%Y_%m_%d_%H.%M.%S")
if [ -z "$DOCKER_HOST" ]
then
if [[ ! -d "./.ipynb_checkponts" ]]; then
mkdir ./.ipynb_checkpoints
fi
echo 'docker run --init --name '$USER'_notebook_'$date_stamp' -e NOTEBOOK_MODE=lab --rm -it --mount type=bind,source=$(pwd),target=/home/jovyan/project -v /data:/data --mount type=bind,source=$HOME/.aws,target=/home/jovyan/.aws -p 8888:8888 rappdw/docker-ds:latest'
docker run --init --name $USER"_notebook_"$date_stamp -e NOTEBOOK_MODE=lab --rm -it --mount type=bind,source=$(pwd),target=/home/jovyan/project -v /data:/data --mount type=bind,source=$HOME/.aws,target=/home/jovyan/.aws -p 8888:8888 rappdw/docker-ds:latest
if [[ -d "/data" ]]; then
if [[ -d "$HOME/.aws" ]]; then
volume_mounts="--mount type=bind,source=$(pwd),target=/home/jovyan/project -v /data:/data --mount type=bind,source=$HOME/.aws,target=/home/jovyan/.aws"
else
volume_mounts="--mount type=bind,source=$(pwd),target=/home/jovyan/project -v /data:/data"
fi
else
if [[ -d "$HOME/.aws" ]]; then
volume_mounts="--mount type=bind,source=$(pwd),target=/home/jovyan/project --mount type=bind,source=$HOME/.aws,target=/home/jovyan/.aws"
else
volume_mounts="--mount type=bind,source=$(pwd),target=/home/jovyan/project"
fi
fi
echo 'docker run --init --name '$USER'_notebook_'$date_stamp' '$DOCKER_ENV' -e NOTEBOOK_MODE=lab --rm -it '$volume_mounts' -p 8888:8888 rappdw/docker-ds:latest'
docker run --init --name $USER"_notebook_"$date_stamp $DOCKER_ENV -e NOTEBOOK_MODE=lab --rm -it $volume_mounts -p 8888:8888 rappdw/docker-ds:latest
else
echo 'docker run --init --name '$USER'_notebook_'$date_stamp' -e NOTEBOOK_MODE=lab --rm -it --mount type=bind,source=/data/workspaces/'$USER'/code/'${PWD##*/}',target=/home/jovyan/project -v /data:/data -p 8888:8888 rappdw/docker-ds:latest'
docker run --init --name $USER"_notebook_"$date_stamp -e NOTEBOOK_MODE=lab --rm -it --mount type=bind,source="/data/workspaces/"$USER"/code/"${PWD##*/}",target=/home/jovyan/project" -v /data:/data -p 8888:8888 rappdw/docker-ds:latest
echo 'docker run --init --name '$USER'_notebook_'$date_stamp' '$DOCKER_ENV' -e NOTEBOOK_MODE=lab --rm -it --mount type=bind,source=/data/workspaces/'$USER'/code/'${PWD##*/}',target=/home/jovyan/project -v /data:/data -p 8888:8888 rappdw/docker-ds:latest'
docker run --init --name $USER"_notebook_"$date_stamp $DOCKER_ENV -e NOTEBOOK_MODE=lab --rm -it --mount type=bind,source="/data/workspaces/"$USER"/code/"${PWD##*/}",target=/home/jovyan/project" -v /data:/data -p 8888:8888 rappdw/docker-ds:latest
fi

fi

0 comments on commit ab8e8a2

Please sign in to comment.