-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Enable (#18) * Add jupyterlab * Add a fix for the dockerspawner. For more details please visit: jupyterhub/dockerspawner#319
- Loading branch information
1 parent
cfd7bef
commit 530c7f5
Showing
8 changed files
with
135 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,16 @@ | |
# Based on Ubuntu 18.04 since v0.11 | ||
FROM phusion/baseimage:0.11 | ||
|
||
LABEL maintainer="Materials Cloud Team <[email protected]>" | ||
|
||
|
||
# Note: The following config can be changed at build time: | ||
# docker build --build-arg NB_UID=200 | ||
ARG NB_USER="scientist" | ||
ARG NB_UID="1000" | ||
ARG NB_GID="1000" | ||
|
||
|
||
USER root | ||
|
||
# Add switch mirror to fix issue #9 | ||
|
@@ -53,6 +63,19 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ | |
zip \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# needed for jupyterlab | ||
RUN apt-get update && apt-get install -y \ | ||
nodejs \ | ||
npm \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Add repo for postgres-9.6 | ||
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ bionic-pgdg main" >> /etc/apt/sources.list.d/pgdg.list | ||
RUN wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O - | apt-key add - | ||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
postgresql-9.6 \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# fix locales | ||
RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && locale-gen | ||
ENV LC_ALL en_US.UTF-8 | ||
|
@@ -76,9 +99,19 @@ RUN pip2 install ipykernel | |
# install packages that are not in the aiidalab meta package | ||
# 'fastentrypoints' is to fix problems with aiida-quantumespresso plugin installation | ||
RUN pip3 install --upgrade \ | ||
'fastentrypoints' \ | ||
'tornado==5.1.1' \ | ||
'jupyterhub==0.9.4' \ | ||
'nbserverproxy==0.8.3' \ | ||
'fastentrypoints' | ||
'notebook==5.7.4' \ | ||
'nbserverproxy==0.8.8' \ | ||
'jupyterlab==0.35.4' \ | ||
'appmode-aiidalab==0.5.0.1' | ||
|
||
# enable nbserverproxy extension | ||
RUN jupyter serverextension enable --sys-prefix --py nbserverproxy | ||
|
||
# workaround to fix pymatgen installation | ||
RUN pip install numpy==1.15.4 | ||
|
||
# This already enables jupyter notebook and server extensions | ||
RUN pip3 install aiidalab==v19.09.0a1 | ||
|
@@ -95,6 +128,21 @@ RUN jupyter nbextension install --sys-prefix --py fileupload | |
|
||
# enable nbserverproxy extension | ||
RUN jupyter serverextension enable --sys-prefix --py nbserverproxy | ||
# enables better integration with jupyterhub | ||
# https://jupyterlab.readthedocs.io/en/stable/user/jupyterhub.html#further-integration | ||
RUN jupyter labextension install @jupyterlab/hub-extension | ||
|
||
|
||
# Install jupyterlab theme | ||
WORKDIR /opt/jupyterlab-theme | ||
RUN git clone https://github.com/aiidalab/jupyterlab-theme && \ | ||
cd jupyterlab-theme && \ | ||
npm install && \ | ||
npm run build && \ | ||
npm run build:webpack && \ | ||
npm pack ./ && \ | ||
jupyter labextension install *.tgz && \ | ||
cd .. | ||
|
||
# install MolPad | ||
WORKDIR /opt | ||
|
@@ -108,9 +156,10 @@ RUN git clone https://github.com/oschuett/molview-ipywidget.git && \ | |
RUN reentry scan | ||
|
||
#=============================================================================== | ||
ADD fix-permissions /usr/local/bin/fix-permissions | ||
RUN mkdir /project && \ | ||
useradd --home /project --uid 1234 --shell /bin/bash scientist && \ | ||
chown -R scientist:scientist /project | ||
useradd --home /project --uid $NB_UID --shell /bin/bash $NB_USER | ||
RUN fix-permissions /project | ||
|
||
# launch postgres server | ||
COPY opt/postgres.sh /opt/ | ||
|
@@ -135,6 +184,9 @@ COPY service/aiida /etc/service/aiida/run | |
|
||
EXPOSE 8888 | ||
|
||
CMD ["/sbin/my_init"] | ||
# remove when the following issue is fixed: https://github.com/jupyterhub/dockerspawner/issues/319 | ||
COPY my_my_init /sbin/my_my_init | ||
|
||
CMD ["/sbin/my_my_init"] | ||
|
||
#EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,6 @@ | |
|
||
set -x | ||
|
||
docker build -t aiidalab-docker-stack:master ./ | ||
docker build -t aiidalab-docker-stack:develop ./ | ||
|
||
#EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/bash | ||
# set permissions on a directory | ||
# after any installation, if a directory needs to be (human) user-writable, | ||
# run this script on it. | ||
# It will make everything in the directory owned by the group $NB_GID | ||
# and writable by that group. | ||
# Deployments that want to set a specific user id can preserve permissions | ||
# by adding the `--group-add users` line to `docker run`. | ||
|
||
# uses find to avoid touching files that already have the right permissions, | ||
# which would cause massive image explosion | ||
|
||
# right permissions are: | ||
# group=$NB_GID | ||
# AND permissions include group rwX (directory-execute) | ||
# AND directories have setuid,setgid bits set | ||
|
||
set -e | ||
|
||
for d in "$@"; do | ||
find "$d" \ | ||
! \( \ | ||
-group $NB_GID \ | ||
-a -perm -g+rwX \ | ||
\) \ | ||
-exec chgrp $NB_GID {} \; \ | ||
-exec chmod g+rwX {} \; | ||
# setuid,setgid *on directories only* | ||
find "$d" \ | ||
\( \ | ||
-type d \ | ||
-a ! -perm -6000 \ | ||
\) \ | ||
-exec chmod +6000 {} \; | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
/sbin/my_init |