forked from gorenje/sysmlv2-jupyter-docker
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile.hub
98 lines (77 loc) · 2.97 KB
/
Dockerfile.hub
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
FROM openjdk:17-slim
##
## This Dockerfile is specifically designed for execution at mybinder.org
##
## wget is used to retrieve Conda and SysML Release. Inkscape and LaTeX is
## required for rendering notebooks as PDFs.
RUN apt-get --quiet --yes update && apt-get install -yqq \
wget \
inkscape \
texlive-fonts-recommended \
texlive-base \
texlive-xetex
##
## Non-root user is a requirement of Binder:
## https://mybinder.readthedocs.io/en/latest/tutorials/dockerfile.html
##
ARG NB_USER=sysml
ARG NB_UID=1000
ENV USER ${NB_USER}
ENV NB_UID ${NB_UID}
ENV HOME /home/${NB_USER}
RUN adduser --disabled-password \
--gecos "Default user" \
--uid ${NB_UID} \
${NB_USER}
USER root
RUN chown -R ${NB_UID} ${HOME}
## Switch to the lowly user, no more root.
USER ${NB_USER}
WORKDIR ${HOME}
##
## Miniconda installation page:
## https://docs.conda.io/en/latest/miniconda.html#linux-installers
##
RUN wget -q https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
## Defining the RELEASE down here ensures that the previous comamnds can
## be recycled since they're not affected by the release version.
ARG RELEASE=2022-10
##
## SysML page: https://github.com/Systems-Modeling/SysML-v2-Release
##
RUN wget -q https://github.com/Systems-Modeling/SysML-v2-Release/archive/${RELEASE}.tar.gz?ts=20220819Z023100+00 -O ${RELEASE}.tar.gz
## Install MiniConda
RUN chmod 755 ${HOME}/Miniconda3-latest-Linux-x86_64.sh
RUN mkdir ${HOME}/conda
RUN ${HOME}/Miniconda3-latest-Linux-x86_64.sh -f -b -p ${HOME}/conda
RUN ${HOME}/conda/condabin/conda init
## Install SysML
RUN tar xzf ${RELEASE}.tar.gz
WORKDIR ${HOME}/SysML-v2-Release-${RELEASE}/install/jupyter
## This is the path that conda init setups but conda init has no effect
## here, so setup the PATH by hand. Else install.sh won't work.
ENV PATH="${HOME}/conda/bin:${HOME}/conda/condabin:/usr/local/openjdk-17/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
RUN ./install.sh
## Uninstall the terminal feature for security reasons
RUN pip uninstall -y terminado
RUN jupyter kernelspec uninstall python3 -y
WORKDIR ${HOME}/SysML-v2-Release-${RELEASE}/
## Move any files in the top level directory to the doc directory
RUN find . -maxdepth 1 -type f -exec mv \{\} doc \;
## Copy all notebooks into the docker image
RUN mkdir notebooks
COPY --chown=${NB_USER} notebooks/ notebooks/
## This only makes sense in the `make spin-up` environment, i.e. locally
RUN rm notebooks/*/StartHere.ipynb
# Move the README notebook to the top level
RUN mv notebooks/*.ipynb .
## Trust the notebooks so that the SVG images will be displayed.
RUN find . -name \*.ipynb -exec jupyter trust \{\} \;
## Copy the start script into the image. This allows us to perform magic
## at runtime with out changing this Dockerfile.
RUN mkdir .scripts
COPY --chown=${NB_USER} scripts/hub.sh .scripts/start.sh
ENV NO_TOKEN=no
RUN chmod 755 .scripts/start.sh
EXPOSE 8888
ENTRYPOINT ./.scripts/start.sh