-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile.jupyterlab-base
More file actions
114 lines (87 loc) · 3.69 KB
/
Dockerfile.jupyterlab-base
File metadata and controls
114 lines (87 loc) · 3.69 KB
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
FROM python:3.14.4-slim-trixie AS base-image
USER root
SHELL ["/bin/bash", "-lc"]
# Install uv.
COPY --from=ghcr.io/astral-sh/uv:0.11.8 /uv /bin/uv
# Set up workspace
RUN mkdir -p /tmp/build
WORKDIR /tmp/build
# Disable hard links during uv package installation since we're using a
# cache on a separate file system.
ENV UV_LINK_MODE=copy
# Install Debian packages needed at runtime
COPY jupyterlab-base/scripts/install-base-packages /tmp/build
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
./install-base-packages
# Install other (non-dpkg) system-level files
COPY jupyterlab-base/scripts/install-system-files /tmp/build
RUN ./install-system-files
# Build-time dependencies, discarded after virtualenv installation.
FROM base-image AS deps-image
COPY jupyterlab-base/scripts/install-dependency-packages /tmp/build
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
./install-dependency-packages
# Install JupyterLab and dependent Python packages.
ADD . /tmp/build
WORKDIR /tmp/build/jupyterlab-base
RUN scripts/install-jupyterlab
FROM base-image AS jupyterlab-image
# Install a bunch of Jupyterlab support stuff.
RUN mkdir -p /usr/local/share/jupyterlab/etc
# Copy UI virtualenv from dependency image
COPY --from=deps-image /usr/local/share/jupyterlab/venv \
/usr/local/share/jupyterlab/venv
# /etc/profile.d parts
RUN mkdir -p /etc/profile.d
COPY jupyterlab-base/profile.d/local01-nbstripjq.sh \
jupyterlab-base/profile.d/local02-hub.sh \
jupyterlab-base/profile.d/local03-pythonrc.sh \
jupyterlab-base/profile.d/local04-path.sh \
jupyterlab-base/profile.d/local05-term.sh \
/etc/profile.d/
# /etc/skel
COPY jupyterlab-base/skel/pythonrc /etc/skel/.pythonrc
# We may want to move these or make them owned by the jupyter user.
# For now they need to live in /usr/local as a compatibility layer with
# older sciplat-lab images.
COPY jupyterlab-base/jupyter_server/jupyter_server_config.json \
jupyterlab-base/jupyter_server/jupyter_server_config.py \
/usr/local/etc/jupyter/
# Configuration specific to the RSP JupyterLab installation.
RUN mkdir -p /usr/local/share/jupyterlab/venv/etc/jupyter
COPY jupyterlab-base/jupyter_server/jupyter_server_config.json \
/usr/local/share/jupyterlab/venv/etc/jupyter/jupyter_server_config.d
COPY jupyterlab-base/jupyter_server/jupyter_server_config.py \
/usr/local/share/jupyterlab/venv/etc/jupyter
# The JupyterLab launch script.
COPY jupyterlab-base/runtime/runlab \
/usr/local/share/jupyterlab/
# Get our manifests. This has always been really useful for debugging
# "what broke this week?"
COPY jupyterlab-base/scripts/generate-versions /tmp/build
RUN ./generate-versions
# This needs to be numeric, since we will remove /etc/passwd and friends
# while we're running.
USER 0:0
# Add startup shim.
COPY jupyterlab-base/scripts/install-compat /tmp/build
RUN ./install-compat
WORKDIR /
# Clean up.
COPY jupyterlab-base/scripts/cleanup-files /
RUN ./cleanup-files && rm ./cleanup-files
WORKDIR /tmp
# Run as unprivileged user. There's no /etc/passwd entry for it at
# this point, but the Nublado machinery will ensure that the right
# unprivileged user runs the container. This is just to keep the
# Lab as running as root in the container by default.
# Conventionally, this is nobody:nogroup.
USER 65534:65534
# Conventional entrypoint
CMD ["/usr/local/share/jupyterlab/runlab"]
# Add descriptive env and label.
ENV DESCRIPTION="Rubin Science Platform Notebook Aspect Base"
ENV SUMMARY="Rubin Science Platform Notebook Aspect Base"
LABEL description="Rubin Science Platform Notebook Aspect Base"