This repository has been archived by the owner on Mar 29, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile
58 lines (54 loc) · 1.89 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
#Image: sd2e/jupyteruser-singularity
#Version: 0.1.1
FROM sd2e/jupyteruser-sd2e:0.3.6
# Image release
USER root
ARG image_version=development
RUN echo "${image_version}" > /etc/sd2e_jupyteruser-singularity-release && \
chmod a+r /etc/sd2e_jupyteruser-singularity-release
# Make sd2e dir
ENV SD2E_DIR=/opt/sd2e
ARG SD2E_HOME=/opt/sd2e/jupyter
RUN [ ! -e $SD2E_DIR ] && mkdir -p $SD2E_HOME && \
##########################################
# Archive HOME
##########################################
cp -r examples SD2E_README.ipynb $SD2E_HOME/ && \
#cp -r .cache $SD2E_HOME/ && \
tar -czf $SD2E_DIR/home_archive.tar.gz -C $SD2E_DIR jupyter && \
chmod 644 $SD2E_DIR/home_archive.tar.gz && \
rm -rf $SD2E_HOME
##########################################
# Modify default config
##########################################
RUN echo "\n\n# Set a password if PASSWORD is set\n\
if 'PASSWORD' in os.environ:\n\
\tfrom IPython.lib import passwd\n\
\tc.NotebookApp.password = passwd(os.environ['PASSWORD'])\n\
\tdel os.environ['PASSWORD']\n\n\
c.NotebookApp.iopub_data_rate_limit=10000000" >> /etc/jupyter/jupyter_notebook_config.py
##########################################
# Update CMD
##########################################
COPY enter_singularity.sh /bin/enter_singularity.sh
RUN chmod 755 /bin/enter_singularity.sh
#ENTRYPOINT ["/bin/bash"]
#CMD ["/bin/enter_singularity.sh"]
ENTRYPOINT ["tini", "--", "/bin/enter_singularity.sh"]
##########################################
# Clean up ENV
##########################################
ENV NB_USER=
ENV NB_UID=
ENV NB_GID=
ENV NB_GROUP=
ENV USER=
ENV HOME='$STOCKYARD/jupyter'
ENV PYTHONUSERBASE='$STOCKYARD/jupyter_packages'
ENV JUPYTER_PATH='$STOCKYARD/jupyter_packages/share/jupyter:'
ENV JUPYTER_WORK='$STOCKYARD/jupyter_packages'
ENV LOCAL_ENVS='$STOCKYARD/jupyter_packages/envs'
ENV CONDA_ENVS_PATH='$STOCKYARD/jupyter_packages/envs:'
#ENV XDG_CACHE_HOME=
#ENV WORK=
USER jupyter