-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile.notebook
69 lines (69 loc) · 2.29 KB
/
Dockerfile.notebook
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
FROM ghcr.io/jhwohlgemuth/dev:latest
#
# %labels
#
LABEL author="Jason Wohlgemuth"
LABEL org.opencontainers.image.source=https://github.com/jhwohlgemuth/gold
LABEL org.opencontainers.image.description="Environment that provides code-server (VS Code) and JupyterLab servers"
LABEL org.opencontainers.image.licenses=MIT
#
# %arguments
#
ARG HOME=/root
ARG MAMBA_VERSION=23.3.1-1
#
# %environment
#
EXPOSE 1337
EXPOSE 13337
ENV CONDA_DIR=/opt/conda
# ENV LD_LIBRARY_PATH=/opt/conda/lib:$LD_LIBRARY_PATH
ENV CERTS_DIR="${HOME}/certs"
ENV JUPYTER_PORT=13337
ENV JUPYTER_ROOT="${HOME}/.jupyter"
ENV JUPYTER_LAB_ROOT="${CONDA_DIR}/share/jupyter/lab"
ENV CODE_SERVER_PORT=1337
ENV CODE_SERVER_CONFIG_DIR=/app/code-server/config
ENV PATH="${PATH}:${CONDA_DIR}/bin"
ENV PATH="${PATH}:/app/code-server/bin"
#
# %setup
#
# Only supported by Apptainer
# Run setup commands outside of the container (on the host system) after the base image bootstrap.
#
# %files
#
COPY --chmod=0755 ./provision/notebook/* /tmp/scripts/
COPY --chmod=0755 ./config/jupyter/service/* /etc/services.d/jupyter/
COPY --chmod=0755 ./config/code-server/service/* /etc/services.d/code-server/
COPY ./config/jupyter/ca.cnf "${CERTS_DIR}/"
COPY ./config/jupyter/custom.css "${JUPYTER_ROOT}/custom/"
COPY ./config/jupyter/jupyter_notebook_config.py "${JUPYTER_ROOT}"
COPY ./config/jupyter/overrides.json "${JUPYTER_LAB_ROOT}/settings/"
COPY ./config/jupyter/environment.yml /tmp/
COPY ./config/code-server/config.yaml /app/code-server/config/
COPY ./config/code-server/settings.json /app/code-server/config/data/Machine/
#
# %post
#
SHELL ["/bin/bash", "-c"]
RUN install_conda
SHELL ["/root/miniconda3/bin/conda", "run", "-n", "base", "/bin/bash", "-c"]
RUN openssl req -new -x509 -days 365 -out "${CERTS_DIR}/my.pem" -config "${CERTS_DIR}/ca.cnf" \
&& mv "$(pwd)/my.key" "${CERTS_DIR}" \
&& /tmp/scripts/install_dependencies.sh \
&& mamba env update --file /tmp/environment.yml \
&& mamba clean -yaf \
&& jupyter contrib nbextension install --user \
&& install_code_server \
&& cleanup
#
# %runscript
#
WORKDIR /root/dev
SHELL ["/bin/bash", "-c"]
HEALTHCHECK --interval=5m --timeout=30s --start-period=10s --retries=3 \
CMD ["sh", "-c", "curl --fail --insecure https://localhost:${CODE_SERVER_PORT} || exit 1"]
ENTRYPOINT [ "/init" ]
CMD ["/bin/zsh"]