Skip to content

Commit

Permalink
Hack to launch jupyter-server (#113)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
minrk authored Feb 14, 2023
1 parent 573b93b commit 5d42d84
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Don't include the .git in the image. It's big!
.git
17 changes: 11 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
FROM ghcr.io/jorgensd/dolfinx-tutorial:v0.6.0

# create user with a home directory
ARG NB_USER
ARG NB_USER=jovyan
ARG NB_UID=1000
ENV USER ${NB_USER}
RUN useradd -m ${NB_USER} -u ${NB_UID}
ENV HOME /home/${NB_USER}

# for binder: base image upgrades lab to require jupyter-server 2,
# but binder explicitly launches jupyter-notebook
# force binder to launch jupyter-server instead
RUN nb=$(which jupyter-notebook) \
&& rm $nb \
&& ln -s $(which jupyter-lab) $nb

# Copy home directory for usage in binder
WORKDIR ${HOME}
COPY . ${HOME}
USER root
RUN chown -R ${NB_UID} ${HOME}
COPY --chown=${NB_UID} . ${HOME}

USER ${NB_USER}
ENTRYPOINT []
ENTRYPOINT []

0 comments on commit 5d42d84

Please sign in to comment.