11#! /bin/bash -i
2- set -e
2+ set -ex
33
44USER_ID=1000
5- USERNAME=${USERNAME:- ${_REMOTE_USER:- " automatic " } }
5+ USERNAME=${USERNAME:- ${_REMOTE_USER} }
66
77echo " Activating feature Renku"
88
9- source ./library_scripts.sh
10-
11- ensure_nanolayer nanolayer_location " v0.4.45"
12-
13- # install git
14- $nanolayer_location \
15- install \
16- devcontainer-feature \
17- " ghcr.io/devcontainers/features/git:1"
18-
19- VERSION=${VERSION:- undefined}
9+ VERSION=${VERSION:- " latest" }
2010if [ " ${VERSION} " = " latest" ]; then
21- VERSION=$( git ls-remote --tags " https://github.com/swissdatasciencecenter /renku-python " | grep -oP " tags/v\K [0-9]+\.[0-9]+\.[0-9]+$ " | sort -rV | head -n 1)
11+ VERSION=$( curl -s https://pypi.org/pypi /renku/json | jq ' .releases | keys | sort | .[] ' | grep -oP " \" [0-9]+\.[0-9]+\.[0-9]\" " | tr -d ' " ' | sort -rV | head -n 1)
2212fi
2313echo " The requested version is: $VERSION "
2414
25- # install apt packages
26- apt-get update --fix-missing && \
27- apt-get install -yq --no-install-recommends \
28- build-essential \
29- bzip2 \
30- ca-certificates \
31- curl \
32- gpg-agent \
33- gnupg \
34- libglib2.0-0 \
35- libsm6 \
36- libxext6 \
37- libxrender1 \
38- rclone \
39- tini \
40- wget \
41- vim && \
42- apt-get purge && \
43- apt-get clean && \
44- apt-get autoremove --yes && \
45- rm -rf /var/lib/apt/lists/* && \
46-
47- $nanolayer_location \
48- install \
49- devcontainer-feature \
50- " ghcr.io/rocker-org/devcontainer-features/miniforge:1"
51-
52- $nanolayer_location \
53- install \
54- devcontainer-feature \
55- " ghcr.io/devcontainers/features/git-lfs:1" \
56- --option version=" 3.3.0"
57-
58- $nanolayer_location \
59- install \
60- devcontainer-feature \
61- " ghcr.io/devcontainers-contrib/features/pipx-package:1" \
62- --option package=" renku" --option version=" $VERSION "
63-
64- # Determine the appropriate user
65- if [ " ${USERNAME} " = " auto" ] || [ " ${USERNAME} " = " automatic" ]; then
66- USERNAME=" "
67- POSSIBLE_USERS=(" vscode" " node" " codespace" " $( awk -v val=1000 -F " :" ' $3==val{print $1}' /etc/passwd) " )
68- for CURRENT_USER in " ${POSSIBLE_USERS[@]} " ; do
69- if id -u " ${CURRENT_USER} " > /dev/null 2>&1 ; then
70- USERNAME=${CURRENT_USER}
71- break
72- fi
73- done
74- elif ! id -u " ${USERNAME} " > /dev/null 2>&1 && [ " $CREATEUSER " = " true" ]; then
15+ # create the user if missing
16+ if ! id -u " ${USERNAME} " > /dev/null 2>&1 && [ " $CREATEUSER " = " true" ]; then
7517 useradd -l -m -s /bin/bash -N -u 1000 " ${USERNAME} "
7618fi
7719
@@ -80,3 +22,8 @@ if [ "${INSTALLJUPYTER}" = "true" ]; then
8022 /opt/conda/bin/mamba install -y jupyterlab
8123 ln -sf /opt/conda/bin/jupyter-server /opt/conda/bin/jupyter-notebook
8224fi
25+
26+ pip install pipx
27+ pipx install renku==${VERSION}
28+
29+ chown -R ${USERNAME} /usr/local/py-utils
0 commit comments