diff --git a/docker-compose/jupyter/Dockerfile b/docker-compose/jupyter/Dockerfile index e499c94aeaa85f8ff96a1109f4ee1f49b49d690d..29f736cdca2fc843750612c6780ea7ad2dfa516e 100644 --- a/docker-compose/jupyter/Dockerfile +++ b/docker-compose/jupyter/Dockerfile @@ -5,6 +5,12 @@ FROM ${SOURCE_IMAGE} # that are needed for temporary storage the proper owner and access rights. ARG CONTAINER_EXECUTION_UID=1000 +# Create homedir +ENV HOME=/home/user +RUN sudo mkdir -p ${HOME} +RUN sudo chown ${CONTAINER_EXECUTION_UID} -R ${HOME} +USER ${CONTAINER_EXECUTION_UID} + RUN sudo pip3 install jupyter RUN sudo pip3 install ipykernel RUN sudo pip3 install jupyter_bokeh @@ -12,12 +18,17 @@ RUN sudo pip3 install jupyter_bokeh RUN sudo pip3 install matplotlib jupyterplot # Allow Download as -> PDF via html +RUN sudo pip3 install nbconvert RUN sudo pip3 install notebook-as-pdf -RUN sudo pyppeteer-install +# pyppeteer-install installs in the homedir, so run it as the user that will execute the notebook +RUN pyppeteer-install + +# see https://github.com/jupyter/nbconvert/issues/1434 +RUN sudo bash -c "echo DEFAULT_ARGS += [\\\"--no-sandbox\\\"] >> /usr/local/lib/python3.7/dist-packages/pyppeteer/launcher.py" +RUN sudo apt-get install -y gconf-service libasound2 libatk1.0-0 libatk-bridge2.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget libcairo-gobject2 libxinerama1 libgtk2.0-0 libpangoft2-1.0-0 libthai0 libpixman-1-0 libxcb-render0 libharfbuzz0b libdatrie1 libgraphite2-3 libgbm1 # Allow Download as -> PDF via LaTeX RUN sudo apt-get install -y texlive-xetex texlive-fonts-recommended texlive-latex-recommended -RUN sudo pip3 install nbconvert # Configure jupyter_bokeh RUN sudo mkdir -p /usr/share/jupyter /usr/etc @@ -27,6 +38,7 @@ RUN sudo jupyter nbextension enable jupyter_bokeh --py --sys-prefix # Install profiles for ipython & jupyter COPY ipython-profiles /opt/ipython-profiles/ +RUN sudo chown ${CONTAINER_EXECUTION_UID} -R /opt/ipython-profiles COPY jupyter-kernels /usr/local/share/jupyter/kernels/ # Install patched jupyter executable @@ -42,8 +54,3 @@ ENV JUPYTER_RUNTIME_DIR=/tmp ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /usr/bin/tini RUN sudo chmod +x /usr/bin/tini -# Make sure Jupyter can write to the home directory -ENV HOME=/home/user -RUN sudo mkdir -p ${HOME} -RUN sudo chown ${CONTAINER_EXECUTION_UID} -R ${HOME} -RUN sudo chown ${CONTAINER_EXECUTION_UID} -R /opt/ipython-profiles