Skip to content

Commit

Permalink
Add script to install helm for dynamic OS and ARCH (#521)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZettWire authored and fcomte committed Dec 18, 2024
1 parent 9f362f2 commit 4a36e67
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
6 changes: 5 additions & 1 deletion onyxia-api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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/ ./
Expand Down
37 changes: 37 additions & 0 deletions onyxia-api/install-helm.sh
Original file line number Diff line number Diff line change
@@ -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}

0 comments on commit 4a36e67

Please sign in to comment.