-
Florian Deuerlein authored11e9b785
Dockerfile 4.05 KiB
FROM ubuntu:focal
LABEL maintainer="Collaboratory Platform <platform@humanbrainproject.eu>"
ARG NB_USER="jovyan"
ARG NB_UID=1000
ARG NB_GID=100
ENV GIT_COMMITTER_NAME=platform@humanbrainproject.eu \
GIT_COMMITTER_EMAIL=platform@humanbrainproject.eu \
USER="${NB_USER}" \
MPLBACKEND=Agg \
SHELL=/bin/bash \
SSL_CERT_DIR=/etc/ssl/certs \
XDG_CACHE_HOME=/tmp/cache/ \
LAB_IMAGE_NAME=EBRAINS_OFFICIAL
USER root
# Set the Switzerland timezone (necessary to make r-base install noninteractive)
RUN ln -sf /usr/share/zoneinfo/Europe/Zurich /etc/localtime
# Set to noninteractive for install
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update --yes && \
apt-get install --yes \
ca-certificates \
cmake \
csh \
curl \
cython \
gcc \
gettext \
git \
libnss-wrapper \
llvm \
lsof \
mpich \
pandoc \
python-dev \
python3-venv \
python3-pip \
r-base \
swig \
unzip \
vim && \
apt-get clean && rm -rf /var/lib/apt/lists/*
# install nodejs
RUN curl -fsSL https://deb.nodesource.com/setup_17.x | bash
RUN apt-get install -y nodejs
# install min texlive (necessary for nb exports)
RUN apt-get update --yes && \
apt-get install --yes --no-install-recommends \
texlive-xetex \
texlive-fonts-recommended \
texlive-plain-generic && \
apt-get clean && rm -rf /var/lib/apt/lists/*
# jupyter install in /opt/app-root/ for legacy reasons (previously based on centos base image)
RUN mkdir -p /opt/app-root/etc /opt/app-root/clb/ /opt/app-root/src
COPY base/jupyter_notebook_config.py /opt/app-root/etc/
# folders for drive integration
RUN mkdir -p /mnt/user/
RUN ln -s /mnt/user/drive /opt/app-root/src/drive
RUN ln -s /mnt/user/shared /opt/app-root/src/shared
ENV HOME=/opt/app-root/src/
# install pip packages
COPY base/requirements.txt /tmp
RUN pip install --no-cache-dir -r /tmp/requirements.txt
# fix missing template issue in nbgitpuller: https://github.com/jupyterhub/nbgitpuller/issues/235
# remove this once it has been fixed in project
RUN ln -s /usr/local/lib/python3.8/dist-packages/nbgitpuller/templates/status.html /usr/local/lib/python3.8/dist-packages/notebook/templates/
# disable ipcluster extension
RUN jupyter labextension disable ipcluster \
ipyparallel-labextension
# install additional labextensions
RUN jupyter labextension install --no-build \
clb-jupyter-ext-query-params@3.2.0 \
clb-lab-extension@0.9.2 \
ipycanvas@0.12.0
# ipycanvas@0.12.0: Python part installed via spack (py-ipycanvas@0.12.0)
RUN jupyter lab build
RUN jupyter notebook --generate-config
RUN mkdir -p /opt/app-root/src/.ipython/profile_default/startup/ /opt/app-root/src/.local/lib/python3.8/site-packages/ /tmp/cache/
# Preload clb_oauth
RUN echo 'from clb_nb_utils import oauth as clb_oauth' >> /opt/app-root/src/.ipython/profile_default/startup/50-clb-nb-utils.py
# install R kernel
RUN R --slave -e "install.packages('IRkernel')"
RUN R --slave -e "IRkernel::installspec(name = 'ir363', displayname = 'R 3.6.3')"
# fix permissions so NB_USER has permissions to run notebooks and install packages
COPY base/fix-permissions /usr/local/bin/fix-permissions
RUN chmod +x /usr/local/bin/fix-permissions
# copy user setup file
COPY base/user_setup.sh /opt/app-root/etc/
RUN chmod +x /opt/app-root/etc/user_setup.sh
RUN fix-permissions /opt/app-root/ && \
fix-permissions /tmp/cache/ && \
fix-permissions /usr/local/share/jupyter/ && \
fix-permissions /usr/local/etc/jupyter && \
fix-permissions /usr/local/lib/R/site-library && \
fix-permissions /usr/etc/jupyter/
# to support OpenShift's arbitrary UIDs
# more info: https://docs.openshift.com/enterprise/3.1/creating_images/guidelines.html
COPY base/passwd.template /tmp/passwd.template
COPY base/group.template /tmp/group.template
COPY base/start-notebook.sh /opt/app-root/etc/
RUN chmod +x /opt/app-root/etc/start-notebook.sh
WORKDIR /opt/app-root/src/
EXPOSE 8080
USER ${NB_UID}
CMD /opt/app-root/etc/start-notebook.sh