Commit b02ed576 authored by Stefano Alberto Russo's avatar Stefano Alberto Russo
Browse files

Added the Jupyter Notebook container.

parent ec686ac4
Loading
Loading
Loading
Loading
+47 −0
Original line number Diff line number Diff line
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'


+3 −0
Original line number Diff line number Diff line
#!/bin/bash

docker build  . -t jupyternotebook
+22 −0
Original line number Diff line number Diff line
#/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'

JupyterNotebook/run.sh

0 → 100755
+2 −0
Original line number Diff line number Diff line
#!/bin/bash
docker run -v$PWD/:/data -p8881:8881 -eBASE_PORT=8881 -eAAUTH_PASS=testpass -it jupyternotebook