forked from aiidalab/aiidalab-docker-stack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
125 lines (101 loc) · 4.3 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
FROM aiidateam/aiida-core:1.6.4
LABEL maintainer="AiiDAlab Team <[email protected]>"
# Specify default factory reset (not set):
ENV AIIDALAB_FACTORY_RESET ""
# Configure environment.
ENV AIIDALAB_HOME /home/${SYSTEM_USER}
ENV AIIDALAB_APPS ${AIIDALAB_HOME}/apps
ENV AIIDALAB_DEFAULT_GIT_BRANCH master
# Specify which apps to install in addition to the home app. The
# AIIDALAB_DEFAULT_APPS variable should be a whitespace-delimited variable
# where each entry must follow the specifier format used by `aiidalab install`.
#
# Example for setting the AIIDALAB_DEFAULT_APPS variable:
#
# AIIDALAB_DEFAULT_APPS="aiidalab-widgets-base quantum-espresso==20.12.0"
#
# Please note that multiple entries must be whitespace delimited.
# Please see `aiidalab install --help` for more information.
ENV AIIDALAB_DEFAULT_APPS "aiidalab-widgets-base~=1.0"
USER root
WORKDIR /opt/
# Install OS dependencies.
# Not clear whether libssl-dev and libffi-dev are still needed.
# povray needed for structure editor widget.
RUN apt-get update && apt-get install -y \
ca-certificates \
file \
libssl-dev \
libffi-dev \
povray \
python3-pip \
&& rm -rf /var/lib/apt/lists/*
# Dependencies needed for Jupyter Lab.
RUN apt-get update && apt-get install -y \
nodejs \
npm \
&& rm -rf /var/lib/apt/lists/*
# Install ngrok to be able to proxy AiiDA RESTful API server.
# Currently not used by the home app, but used in tutorials
RUN wget --quiet -P /tmp/ \
https://bin.equinox.io/a/dnxFaDKQgP4/ngrok-2.3.35-linux-amd64.zip \
&& unzip /tmp/ngrok-2.3.35-linux-amd64.zip \
&& mv ./ngrok /usr/local/bin/ \
&& rm -f /tmp/ngrok-2.3.35-linux-amd64.zip
# Get recent version of pip (needed for `pip cache` command).
# New pip executable is installed into /usr/local/bin
RUN /usr/bin/pip3 install --upgrade pip
# Jupyter dependencies installed into system python environment
# which runs the jupyter notebook server.
COPY requirements-server.txt .
RUN /usr/local/bin/pip install -r /opt/requirements-server.txt \
&& /usr/local/bin/pip cache purge
# Install and enable appmode.
RUN git clone https://github.com/oschuett/appmode.git && cd appmode && git reset --hard v0.8.0
COPY gears.svg ./appmode/appmode/static/gears.svg
RUN /usr/local/bin/pip install ./appmode
RUN /usr/local/bin/jupyter nbextension enable --py --sys-prefix appmode
RUN /usr/local/bin/jupyter serverextension enable --py --sys-prefix appmode
# Install jupyterlab theme (takes about 4 minutes and 10 seconds).
#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 ./ && \
# /usr/local/bin/jupyter labextension install *.tgz && \
# cd ..
## Configure user environment
# Install some useful packages that are not available on PyPi.
# The 2020.09.2 version of rdkit introduced an implicit dependency on tornado>=6.
RUN conda install --yes -c conda-forge \
openbabel==3.1.1 \
rdkit==2020.09.1 \
&& conda clean --all
# Install AiiDAlab Python packages into user conda environment and populate reentry cache.
COPY requirements.txt .
ARG extra_requirements
RUN pip install --upgrade pip
RUN pip install -r requirements.txt $extra_requirements
RUN reentry scan
# Install python kernel from the conda environment (comes with the aiidalab package).
RUN python -m ipykernel install
# Perform factory reset if needed.
COPY my_init.d/factory_reset.sh /etc/my_init.d/09_factory_reset.sh
# Prepare user's folders for AiiDAlab launch.
COPY opt/aiidalab-singleuser /opt/
COPY opt/prepare-aiidalab.sh /opt/
COPY my_init.d/prepare-aiidalab.sh /etc/my_init.d/80_prepare-aiidalab.sh
# Install the aiidalab-home app.
ARG aiidalab_home_version=v21.10.0
RUN git clone https://github.com/aiidalab/aiidalab-home && cd aiidalab-home && git checkout $aiidalab_home_version
RUN chmod 774 aiidalab-home
# Copy scripts to start Jupyter notebook.
COPY opt/start-notebook.sh /opt/
COPY service/jupyter-notebook /etc/service/jupyter-notebook/run
# Expose port 8888.
EXPOSE 8888
# 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"]