-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile.template
72 lines (72 loc) · 3.2 KB
/
Dockerfile.template
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
FROM {{INPUT}}{{TAG}}
USER root
SHELL ["/bin/bash", "-lc"]
# If we don't have locales set correctly, the pip install pieces can fail.
# Maybe they should be ARGs, but this seems like a reasonable thing to
# put in the environment by default.
ENV LANG=en_US.UTF-8
# Runtime scripts use ${LOADRSPSTACK} but we need the distinction
# in case you want to create a separate environment for the JupyterLab-
# specific pieces.
ENV LOADSTACK=/opt/lsst/software/stack/loadLSST.bash
ENV LOADRSPSTACK=/opt/lsst/software/rspstack/loadrspstack.bash
RUN mkdir -p /opt/lsst/software/rspstack
# If you want the JupyterLab pieces in their own environment, do the
# COPY and add the environment clone to the python build stage. This
# increases container size by about 60%. If you want it in the same
# environment (the default), link the RSP loadstack instead.
#COPY loadrspstack.bash ${LOADRSPSTACK}
# In general: if an environment variable needs to be used across multiple
# stages, make it an ARG. Introduce it before the first stage that uses it.
RUN ln -s ${LOADSTACK} ${LOADRSPSTACK}
ARG srcdir=/opt/lsst/src
ARG BLD=${srcdir}/build
ARG jl=/opt/lsst/software/jupyterlab
ARG verdir="${jl}/versions.installed"
RUN mkdir -p ${BLD} ${verdir}
COPY stage1-rpm.sh ${BLD}
RUN ${BLD}/stage1-rpm.sh
COPY stage2-os.sh ${BLD}
RUN ${BLD}/stage2-os.sh
COPY stage3-py.sh ${BLD}
RUN ${BLD}/stage3-py.sh
# This should be exposed at runtime for JupyterLab, hence ENV
ENV NODE_OPTIONS="--max-old-space-size=7168 --max-http-header-size=16384"
RUN mkdir -p /usr/local/etc/jupyter
# We update the config during stage 4.
COPY jupyter_server_config.json jupyter_server_config.py \
/usr/local/etc/jupyter/
COPY stage4-jup.sh ${BLD}
RUN ${BLD}/stage4-jup.sh
COPY local01-nbstripjq.sh local02-hub.sh local03-showrspnotice.sh \
local04-pythonrc.sh local05-path.sh local06-term.sh \
local07-namespaceenv.sh \
/etc/profile.d/
COPY lsst_kernel.json \
/usr/local/share/jupyter/kernels/lsst/kernel.json
COPY rsp_notice /usr/local/etc
COPY pythonrc /etc/skel/.pythonrc
COPY gitconfig /etc/skel/.gitconfig
COPY git-credentials /etc/skel/.git-credentials
COPY user_setups /etc/skel/notebooks/.user_setups
COPY lsst_kernel.json lsstlaunch.bash runlab.sh 20-logging.py \
${jl}/
# If running noninteractively, configuration configmap must be mounted at
# /opt/lsst/software/jupyterlab/noninteractive/command/command.json
# and env. var NONINTERACTIVE must be set
COPY stage5-ro.sh ${BLD}
RUN ${BLD}/stage5-ro.sh
# Overwrite Stack Container definitions with more-accurate-for-us ones
ENV DESCRIPTION="Rubin Science Platform Notebook Aspect"
ENV SUMMARY="Rubin Science Platform Notebook Aspect"
WORKDIR /tmp
# This needs to be numeric for k8s non-root contexts. We will
# replace it with the actual UID in the JupyterHub spawner, but 1000:1000
# is the container underlying lsst user, here lsst_local (as explained in
# stage5-ro.sh). So just in case it's spawned by someone outside a JL
# context, and they manage to get all the setup env right, still not root.
USER 1000:1000
CMD [ "/opt/lsst/software/jupyterlab/runlab.sh" ]
LABEL description="Rubin Science Platform Notebook Aspect: {{IMAGE}}" \
name="{{IMAGE}}" \
version="{{VERSION}}"