diff --git a/JupyterNotebook/Dockerfile b/JupyterNotebook/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..a41065a8b434c89b152a1c09bbfdfa5bda8c621a --- /dev/null +++ b/JupyterNotebook/Dockerfile @@ -0,0 +1,47 @@ +FROM base +MAINTAINER Stefano Alberto Russo <stefano.russo@inaf.it> + +# Switch to root +USER root + +#------------------------ +# Install Jupyter +#------------------------ + +# Curl +RUN apt-get install curl -y + +# Install get-pip script +RUN curl -O https://bootstrap.pypa.io/get-pip.py + +# Install Python3 and Pip3 +RUN apt-get install python3 python3-distutils -y +RUN python3 get-pip.py #-c <(echo 'pip==20.2') + +# Python-tk required by matplotlib/six +RUN apt-get install python-tk python3-tk python3-dev build-essential -y + +# Install Jupyter and Sphinx for docs +RUN pip3 install notebook==5.7.10 + + +#------------------------ +# Post-intall +#------------------------ + +# Fix home permissions +RUN chmod 777 /home + +# Set entrypoint command +COPY files/entrypoint.sh /usr/bin/entrypoint.sh +RUN chmod 755 /usr/bin/entrypoint.sh +ENV DEFAULT_ENTRYPOINT_COMMAND="/usr/bin/entrypoint.sh" + +# Set user +USER metauser + +# Set container name +ENV CONTAINER_NAME='jupyternotebook' + + + diff --git a/JupyterNotebook/build.sh b/JupyterNotebook/build.sh new file mode 100755 index 0000000000000000000000000000000000000000..62d31977e5c16ee95d8518d7cbc6d4a16d4035b3 --- /dev/null +++ b/JupyterNotebook/build.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +docker build . -t jupyternotebook diff --git a/JupyterNotebook/files/entrypoint.sh b/JupyterNotebook/files/entrypoint.sh new file mode 100644 index 0000000000000000000000000000000000000000..24e59f04b9b78dad7f27dae437ccddf3332c6935 --- /dev/null +++ b/JupyterNotebook/files/entrypoint.sh @@ -0,0 +1,22 @@ +#/bin/bash + +# Set port +if [ "x$BASE_PORT" == "x" ]; then + BASE_PORT=8888 + echo "[INFO] using default Notebook server port (8888)" +else + echo "[INFO] Setting Notebook server port to $BASE_PORT" +fi + +# Set password +if [ "x$AUTH_PASS" == "x" ]; then + echo "[INFO] Not using anyNotebook server password" +else + echo "[INFO] Setting Notebook server password to $AUTH_PASS" +fi + +# Create Notebooks dir if not existent +mkdir -p /home/metauser/notebooks + +# Run the Jupyter Notebook server. Use --allow-root if need to run as root. +exec jupyter notebook --ip=0.0.0.0 --port=$BASE_PORT --no-browser --NotebookApp.token=$AUTH_PASS --NotebookApp.notebook_dir='/home/metauser/notebooks' diff --git a/JupyterNotebook/run.sh b/JupyterNotebook/run.sh new file mode 100755 index 0000000000000000000000000000000000000000..720602c89fefc6bf9e2a6326dc611cfbfcaebf0a --- /dev/null +++ b/JupyterNotebook/run.sh @@ -0,0 +1,2 @@ +#!/bin/bash +docker run -v$PWD/:/data -p8881:8881 -eBASE_PORT=8881 -eAAUTH_PASS=testpass -it jupyternotebook