1- # build: docker build --no-cache --progress=plain --target binary --build-arg HELM_VERSION=3.17.3 -t tobi312/tools:static-helm -f static-helm.scratch.Dockerfile .
1+ # build: docker build --no-cache --progress=plain --target binary --build-arg HELM_VERSION=3.19.0 -t tobi312/tools:static-helm -f static-helm.scratch.Dockerfile .
22ARG HELM_VERSION
33FROM golang:alpine AS static-helm
44
55ARG HELM_VERSION
6+ ARG HELM_DIFF_VERSION
67
78# helm https://github.com/helm/helm
89
910SHELL ["/bin/ash" , "-euxo" , "pipefail" , "-c" ]
1011
1112RUN \
13+ # apk add --no-cache git ; \
1214 OS="$(go env GOOS)" ; \
1315 ARCH="$(go env GOARCH)" ; \
1416 TARGETARCH="${ARCH}" ; \
1517 \
18+ # https://github.com/helm/helm
1619 HELM_VERSION=${HELM_VERSION:-$(wget -qO- https://api.github.com/repos/helm/helm/releases/latest | grep 'tag_name' | cut -d\" -f4)} ; \
1720 HELM_VERSION=$(echo ${HELM_VERSION} | sed 's/^v//' ) ; \
1821 echo ">> HELM_VERSION=${HELM_VERSION}" ; \
1922 wget -qO- "https://get.helm.sh/helm-v${HELM_VERSION}-${OS}-${TARGETARCH}.tar.gz" | tar -xz --strip-components=1 -C /usr/local/bin/ ${OS}-${TARGETARCH}/helm ; \
2023 chmod +x /usr/local/bin/helm ; \
2124 echo ">> HELM_VERSION (check): $(helm version)" ; \
2225 echo ">> helm Help:" ; \
23- helm --help
24-
26+ helm --help ; \
27+ \
28+ # helm plugins directory
29+ mkdir -p ~/.local/share/helm/plugins ; \
30+ \
31+ # https://github.com/databus23/helm-diff
32+ if [ "$ARCH" != "riscv64" ]; then \
33+ if [ "$ARCH" = "arm" ]; then TARGETARCH="${TARGETARCH}v7" ; fi ; \
34+ HELM_DIFF_VERSION=${HELM_DIFF_VERSION:-$(wget -qO- https://api.github.com/repos/databus23/helm-diff/releases/latest | grep 'tag_name' | cut -d\" -f4)} ; \
35+ HELM_DIFF_VERSION=$(echo ${HELM_DIFF_VERSION} | sed 's/^v//' ) ; \
36+ echo ">> HELM_DIFF_VERSION=${HELM_DIFF_VERSION}" ; \
37+ mkdir -p ~/.local/share/helm/plugins/helm-diff ; \
38+ wget -qO- "https://github.com/databus23/helm-diff/releases/download/v${HELM_DIFF_VERSION}/helm-diff-${OS}-${TARGETARCH}.tgz" | tar -xz --strip-components=1 -C ~/.local/share/helm/plugins/helm-diff ; \
39+ echo ">> HELM_DIFF_VERSION (check): $(helm diff version)" ; \
40+ echo ">> helm diff Help:" ; \
41+ helm diff --help ; \
42+ else \
43+ echo "unknown arch: $ARCH" ; \
44+ fi
2545
2646FROM scratch AS binary
2747
2848ARG HELM_VERSION
49+ ARG HELM_DIFF_VERSION
2950ARG VCS_REF
3051ARG BUILD_DATE
3152
@@ -42,8 +63,10 @@ LABEL org.opencontainers.image.title="helm" \
4263 org.opencontainers.image.source="https://github.com/helm/helm"
4364
4465COPY --from=static-helm /usr/local/bin/helm /usr/local/bin/helm
66+ COPY --from=static-helm /root/.local/share/helm/plugins /root/.local/share/helm/plugins
4567
4668RUN ["helm" , "version" ]
69+ # RUN ["helm", "diff", "version"]
4770
4871ENTRYPOINT ["helm" ]
4972# CMD ["version"]
0 commit comments