From 4a36e67907f68ac2cf0b55ad9018ac32f0251303 Mon Sep 17 00:00:00 2001 From: ZettWire Date: Thu, 21 Nov 2024 15:59:46 +0100 Subject: [PATCH] Add script to install helm for dynamic OS and ARCH (#521) --- onyxia-api/Dockerfile | 6 +++++- onyxia-api/install-helm.sh | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100755 onyxia-api/install-helm.sh diff --git a/onyxia-api/Dockerfile b/onyxia-api/Dockerfile index f2399608..6f79b63c 100644 --- a/onyxia-api/Dockerfile +++ b/onyxia-api/Dockerfile @@ -6,12 +6,16 @@ RUN java -Djarmode=layertools -jar application.jar extract FROM eclipse-temurin:21.0.4_7-jre WORKDIR /app # Install helm -RUN curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | DESIRED_VERSION=v3.15.3 bash +COPY install-helm.sh install-helm.sh +RUN ./install-helm.sh +RUN rm install-helm.sh +# Create onyxia group and user RUN groupadd --gid 101 --system onyxia && \ useradd --system --uid 101 --create-home --home-dir /var/cache/onyxia --shell /sbin/nologin --gid onyxia --comment onyxia onyxia # Allow adding CA certificates ENV CACERTS_DIR="/usr/local/share/ca-certificates" RUN chown onyxia $JAVA_HOME/lib/security/cacerts +# copy build extraction COPY --from=extract dependencies/ ./ COPY --from=extract snapshot-dependencies/ ./ COPY --from=extract spring-boot-loader/ ./ diff --git a/onyxia-api/install-helm.sh b/onyxia-api/install-helm.sh new file mode 100755 index 00000000..fb57a378 --- /dev/null +++ b/onyxia-api/install-helm.sh @@ -0,0 +1,37 @@ +#! /bin/bash +HELM_VERSION=v3.16.1 + +# initOS discovers the operating system for this system. +initOS() { + OS=$(echo `uname`|tr '[:upper:]' '[:lower:]') + + case "$OS" in + # Minimalist GNU for Windows + mingw*|cygwin*) OS='windows';; + esac +} + +# initArch discovers the architecture for this system. +initArch() { + ARCH=$(uname -m) + case $ARCH in + armv5*) ARCH="armv5";; + armv6*) ARCH="armv6";; + armv7*) ARCH="arm";; + aarch64) ARCH="arm64";; + x86) ARCH="386";; + x86_64) ARCH="amd64";; + i686) ARCH="386";; + i386) ARCH="386";; + esac +} + +initOS +initArch +HELM_DIST="helm-${HELM_VERSION}-${OS}-${ARCH}.tar.gz" +wget https://get.helm.sh/${HELM_DIST} +tar -zxvf ${HELM_DIST} +mv ${OS}-${ARCH}/helm /usr/local/bin/helm +rm ${HELM_DIST} +rm -rf ${OS}-${ARCH} +