Skip to content

Commit 878cb35

Browse files
authored
feat: Add tini process manager to jupyterlab (#41)
* feat: add tini buildpack to builder * chore: use tini buildpack instead of installing * fix: use tini as init
1 parent 8856d6f commit 878cb35

5 files changed

Lines changed: 26 additions & 16 deletions

File tree

builders/selector/builder.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ description = "Builder for Renku frontends and environments."
2121
uri = "../../buildpacks/rstudio"
2222
version = "0.0.2"
2323

24+
[[buildpacks]]
25+
uri = "https://github.com/paketo-buildpacks/tini/releases/download/v0.3.2/tini-0.3.2.cnb"
26+
version = "0.3.2"
27+
2428
[[buildpacks]]
2529
uri = "docker://gcr.io/paketo-buildpacks/python:2.24.3"
2630
version = "2.24.3"
@@ -35,6 +39,9 @@ description = "Builder for Renku frontends and environments."
3539

3640
[[order]]
3741

42+
[[order.group]]
43+
id = "paketo-buildpacks/tini"
44+
version = "0.3.2"
3845
[[order.group]]
3946
id = "paketo-buildpacks/miniconda"
4047
version = "0.10.4"
@@ -65,6 +72,9 @@ description = "Builder for Renku frontends and environments."
6572

6673
[[order]]
6774

75+
[[order.group]]
76+
id = "paketo-buildpacks/tini"
77+
version = "0.3.2"
6878
[[order.group]]
6979
id = "paketo-buildpacks/miniconda"
7080
version = "0.10.4"

buildpacks/jupyterlab/bin/build

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ EOL
5959
cat >"${layers_dir}/launch.toml" <<EOL
6060
[[processes]]
6161
type = "jupyterlab"
62-
command = ["jupyterlab-entrypoint.sh"]
63-
args = []
62+
command = ["tini", "-g", "--"]
63+
args = ["bash", "jupyterlab-entrypoint.sh"]
6464
default = true
6565
EOL

buildpacks/jupyterlab/bin/detect

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ cat >"${CNB_BUILD_PLAN_PATH}" <<EOL
1818
[[provides]]
1919
name = "jupyterlab"
2020
21+
[[requires]]
22+
name = "tini"
23+
24+
[requires.metadata]
25+
launch = true
26+
2127
[[requires]]
2228
name = "jupyterlab"
2329

buildpacks/rstudio/bin/build

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,6 @@ mkdir -p /tmp/rstudio
2828
dpkg -x "$cache_layer_dir/$FNAME" "/tmp/rstudio"
2929
cp -r /tmp/rstudio/usr/lib/rstudio-server/* "$rstudio_layer_dir/"
3030

31-
TINI_VERSION="v0.19.0"
32-
if [ -f "$cache_layer_dir/tini-$TINI_VERSION" ]; then
33-
echo "Found tini $TINI_VERSION in $cache_layer_dir skipping download"
34-
else
35-
echo "Downloading tini $TINI_VERSION in $cache_layer_dir"
36-
curl -sSL "https://github.com/krallin/tini/releases/download/$TINI_VERSION/tini-amd64" -o "$cache_layer_dir/tini-$TINI_VERSION"
37-
fi
38-
39-
echo "Installing tini $TINI_VERSION to $rstudio_layer_dir/bin"
40-
cp "$cache_layer_dir/tini-$TINI_VERSION" "$rstudio_layer_dir/bin/tini"
41-
chmod a+x "$rstudio_layer_dir/bin/tini"
42-
4331
echo "Setting up launch environment variables"
4432
mkdir -p "${launch_env_dir}"
4533
printf "0.0.0.0" >"${launch_env_dir}/RENKU_SESSION_IP.default"

buildpacks/rstudio/bin/detect

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,16 @@ cat >"${CNB_BUILD_PLAN_PATH}" <<EOL
1717
1818
[requires.metadata]
1919
launch = true
20-
20+
21+
[[requires]]
22+
name = "tini"
23+
24+
[requires.metadata]
25+
launch = true
26+
2127
[[requires]]
2228
name = "conda"
23-
29+
2430
[requires.metadata]
2531
build = true
2632
EOL

0 commit comments

Comments
 (0)