2020-02-20 10:03:48 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
cd $(cd -P -- "$(dirname -- "$0")" && pwd -P)
|
|
|
|
|
|
|
|
# Set the path of the generated Dockerfile
|
|
|
|
export DOCKERFILE=".build/Dockerfile"
|
|
|
|
export STACKS_DIR=".build/docker-stacks"
|
|
|
|
|
|
|
|
|
|
|
|
# Clone if docker-stacks doesn't exist, and pull.
|
|
|
|
ls $STACKS_DIR/README.md > /dev/null 2>&1 || (echo "Docker-stacks was not found, cloning repository" \
|
|
|
|
&& git clone https://github.com/jupyter/docker-stacks.git $STACKS_DIR)
|
2020-02-22 13:51:28 +00:00
|
|
|
cd $STACKS_DIR && git pull && cd -
|
|
|
|
|
2020-02-20 10:03:48 +00:00
|
|
|
|
|
|
|
# Write the contents into the DOCKERFILE and start with the header
|
|
|
|
cat src/Dockerfile.header > $DOCKERFILE
|
|
|
|
cp src/jupyter_notebook_config.json .build/
|
|
|
|
|
|
|
|
echo "
|
|
|
|
############################################################################
|
|
|
|
#################### Dependency: jupyter/base-image ########################
|
|
|
|
############################################################################
|
|
|
|
" >> $DOCKERFILE
|
|
|
|
cat $STACKS_DIR/base-notebook/Dockerfile | grep -v BASE_CONTAINER >> $DOCKERFILE
|
2020-02-22 14:10:11 +00:00
|
|
|
|
2020-02-22 17:56:54 +00:00
|
|
|
# copy files that are used during the build:
|
2020-02-20 10:03:48 +00:00
|
|
|
cp $STACKS_DIR/base-notebook/jupyter_notebook_config.py .build/
|
2020-02-22 14:10:11 +00:00
|
|
|
cp $STACKS_DIR/base-notebook/fix-permissions .build/
|
2020-02-20 10:03:48 +00:00
|
|
|
cp $STACKS_DIR/base-notebook/start.sh .build/
|
|
|
|
cp $STACKS_DIR/base-notebook/start-notebook.sh .build/
|
|
|
|
cp $STACKS_DIR/base-notebook/start-singleuser.sh .build/
|
2020-02-23 19:26:12 +00:00
|
|
|
chmod 755 .build/*
|
2020-02-20 10:03:48 +00:00
|
|
|
|
|
|
|
echo "
|
|
|
|
############################################################################
|
|
|
|
################# Dependency: jupyter/minimal-notebook #####################
|
|
|
|
############################################################################
|
|
|
|
" >> $DOCKERFILE
|
|
|
|
cat $STACKS_DIR/minimal-notebook/Dockerfile | grep -v BASE_CONTAINER >> $DOCKERFILE
|
|
|
|
|
|
|
|
echo "
|
|
|
|
############################################################################
|
|
|
|
################# Dependency: jupyter/scipy-notebook #######################
|
|
|
|
############################################################################
|
|
|
|
" >> $DOCKERFILE
|
|
|
|
cat $STACKS_DIR/scipy-notebook/Dockerfile | grep -v BASE_CONTAINER >> $DOCKERFILE
|
|
|
|
|
|
|
|
echo "
|
|
|
|
############################################################################
|
|
|
|
################ Dependency: jupyter/datascience-notebook ##################
|
|
|
|
############################################################################
|
|
|
|
" >> $DOCKERFILE
|
|
|
|
cat $STACKS_DIR/datascience-notebook/Dockerfile | grep -v BASE_CONTAINER >> $DOCKERFILE
|
|
|
|
|
|
|
|
|
|
|
|
# Note that the following step also installs the cudatoolkit, which is
|
|
|
|
# essential to access the GPU.
|
|
|
|
echo "
|
|
|
|
############################################################################
|
2020-02-24 20:35:15 +00:00
|
|
|
########################## Dependency: gpulibs #############################
|
2020-02-20 10:03:48 +00:00
|
|
|
############################################################################
|
|
|
|
" >> $DOCKERFILE
|
2020-02-24 20:35:15 +00:00
|
|
|
cat src/Dockerfile.gpulibs >> $DOCKERFILE
|
2020-02-20 10:03:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
echo "
|
|
|
|
############################################################################
|
|
|
|
############################ Useful packages ###############################
|
|
|
|
############################################################################
|
|
|
|
" >> $DOCKERFILE
|
|
|
|
cat src/Dockerfile.usefulpackages >> $DOCKERFILE
|
|
|
|
|
2020-02-25 07:40:59 +00:00
|
|
|
# Copy the demo notebooks and change permissions
|
|
|
|
cp -r extra/Getting_Started data
|
|
|
|
chmod -R 755 data/
|
2020-02-22 19:40:18 +00:00
|
|
|
#cp $(find $(dirname $DOCKERFILE) -type f | grep -v $STACKS_DIR | grep -v .gitkeep) .
|
2020-02-22 17:56:54 +00:00
|
|
|
|
2020-02-23 12:50:04 +00:00
|
|
|
echo "GPU Dockerfile was generated sucessfully in file ${DOCKERFILE}."
|
2020-02-20 10:03:48 +00:00
|
|
|
echo "Run 'bash run_Dockerfile.sh -p [PORT]' to start the GPU-based Juyterlab instance."
|