Skip to content

Commit 5d42d84

Browse files
authored
Hack to launch jupyter-server (#113)
* omit .git dir from image * dockerfile cleanup: reduce size of repo with `COPY --chown` COPY/RUN chown doubles the size of the repo in the image also make sure NB_USER is not empty and present in system info * hack: launch jupyter-server instead of jupyter-notebook BinderHub forces a launch of the legacy jupyter-notebook server, but our base image has upgraded jupyterlab and jupyter-server to a version that doesn't support it the alternative would be to pin-down jupyter server and everything using it
1 parent 573b93b commit 5d42d84

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

.dockerignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Don't include the .git in the image. It's big!
2+
.git

Dockerfile

+11-6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
11
FROM ghcr.io/jorgensd/dolfinx-tutorial:v0.6.0
22

33
# create user with a home directory
4-
ARG NB_USER
4+
ARG NB_USER=jovyan
55
ARG NB_UID=1000
6-
ENV USER ${NB_USER}
6+
RUN useradd -m ${NB_USER} -u ${NB_UID}
77
ENV HOME /home/${NB_USER}
88

9+
# for binder: base image upgrades lab to require jupyter-server 2,
10+
# but binder explicitly launches jupyter-notebook
11+
# force binder to launch jupyter-server instead
12+
RUN nb=$(which jupyter-notebook) \
13+
&& rm $nb \
14+
&& ln -s $(which jupyter-lab) $nb
15+
916
# Copy home directory for usage in binder
1017
WORKDIR ${HOME}
11-
COPY . ${HOME}
12-
USER root
13-
RUN chown -R ${NB_UID} ${HOME}
18+
COPY --chown=${NB_UID} . ${HOME}
1419

1520
USER ${NB_USER}
16-
ENTRYPOINT []
21+
ENTRYPOINT []

0 commit comments

Comments
 (0)