From 6726a61a7962b4b42f2d95f96e3bb311d7e30b61 Mon Sep 17 00:00:00 2001 From: Jan David Mol <mol@astron.nl> Date: Mon, 29 Mar 2021 16:58:14 +0200 Subject: [PATCH] Allow jupyter notebook to start with a configurable UID (defaults to build user) --- docker-compose/Makefile | 2 +- docker-compose/jupyter.yml | 1 + docker-compose/jupyter/Dockerfile | 11 ++++++----- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/docker-compose/Makefile b/docker-compose/Makefile index 65de8951a..94bbd94d9 100644 --- a/docker-compose/Makefile +++ b/docker-compose/Makefile @@ -82,7 +82,7 @@ endif DOCKER_COMPOSE_ARGS := DISPLAY=$(DISPLAY) XAUTHORITY=$(XAUTHORITY) TANGO_HOST=$(TANGO_HOST) \ NETWORK_MODE=$(NETWORK_MODE) XAUTHORITY_MOUNT=$(XAUTHORITY_MOUNT) TANGO_SKA_CONTAINER_MOUNT=$(TANGO_SKA_CONTAINER_MOUNT) TANGO_LOFAR_CONTAINER_MOUNT=$(TANGO_LOFAR_CONTAINER_MOUNT) TANGO_LOFAR_CONTAINER_DIR=${TANGO_LOFAR_CONTAINER_DIR} MYSQL_HOST=$(MYSQL_HOST) \ - CONTAINER_NAME_PREFIX=$(CONTAINER_NAME_PREFIX) COMPOSE_IGNORE_ORPHANS=true + CONTAINER_NAME_PREFIX=$(CONTAINER_NAME_PREFIX) COMPOSE_IGNORE_ORPHANS=true LOFAR_UID=$(shell id -u) .PHONY: up down minimal start stop status clean pull help diff --git a/docker-compose/jupyter.yml b/docker-compose/jupyter.yml index f1970916f..d5aed24cc 100644 --- a/docker-compose/jupyter.yml +++ b/docker-compose/jupyter.yml @@ -26,6 +26,7 @@ services: - DISPLAY=${DISPLAY} ports: - "8888:8888" + user: ${LOFAR_UID} working_dir: /jupyter-notebooks entrypoint: - /usr/local/bin/wait-for-it.sh diff --git a/docker-compose/jupyter/Dockerfile b/docker-compose/jupyter/Dockerfile index 336179e73..cb96c2e6d 100644 --- a/docker-compose/jupyter/Dockerfile +++ b/docker-compose/jupyter/Dockerfile @@ -1,15 +1,15 @@ ARG VERSION=latest FROM nexus.engageska-portugal.pt/ska-docker/tango-itango:${VERSION} -RUN pip3 install jupyter -RUN pip3 install ipykernel -RUN pip3 install jupyter_bokeh +RUN sudo pip3 install jupyter +RUN sudo pip3 install ipykernel +RUN sudo pip3 install jupyter_bokeh # Configure jupyter_bokeh RUN sudo mkdir -p /usr/share/jupyter /usr/etc RUN sudo chmod a+rwx /usr/share/jupyter /usr/etc -RUN jupyter nbextension install --sys-prefix --symlink --py jupyter_bokeh -RUN jupyter nbextension enable jupyter_bokeh --py --sys-prefix +RUN sudo jupyter nbextension install --sys-prefix --symlink --py jupyter_bokeh +RUN sudo jupyter nbextension enable jupyter_bokeh --py --sys-prefix # Install profiles for ipython & jupyter COPY ipython-profiles /opt/ipython-profiles/ @@ -18,5 +18,6 @@ COPY jupyter-kernels /usr/local/share/jupyter/kernels/ # Add Tini. Tini operates as a process subreaper for jupyter. This prevents kernel crashes. ENV TINI_VERSION v0.6.0 +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 -- GitLab