From 5eaa06835b54a26ec56777e986d7cfff6ef52c07 Mon Sep 17 00:00:00 2001 From: peng wu <2030047311@qq.com> Date: Wed, 13 Mar 2024 14:28:43 +0800 Subject: [PATCH] feat: support helm plugin mapkubeapis --- Dockerfile | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 61fe175..94eeba8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,8 @@ -From alpine:3.18.2 +FROM alpine:3.18.2 ARG KUBECTL_VERSION=v1.27.4 ARG HELM_VERSION=v3.12.2 +ARG KUSTOMIZE_VERSION=v5.1.0 ARG TARGETOS ARG TARGETARCH @@ -14,19 +15,27 @@ RUN apk update && apk add \ curl \ wget \ tcpdump \ + git \ ca-certificates && \ update-ca-certificates && \ rm -rf /var/cache/apk/* && \ - curl -LO https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/${TARGETOS}/${TARGETARCH}/kubectl && \ - chmod +x ./kubectl && \ - mv ./kubectl /usr/local/bin/kubectl && \ - echo -e 'source /usr/share/bash-completion/bash_completion\nsource <(kubectl completion bash)' >>~/.bashrc && \ curl -SsLO https://get.helm.sh/helm-${HELM_VERSION}-${TARGETOS}-${TARGETARCH}.tar.gz && \ - tar xf helm-${HELM_VERSION}-${TARGETOS}-${TARGETARCH}.tar.gz -C /usr/local/bin && \ + tar xf helm-${HELM_VERSION}-${TARGETOS}-${TARGETARCH}.tar.gz -C /usr/local/bin && \ mv /usr/local/bin/${TARGETOS}-${TARGETARCH}/helm /usr/local/bin && \ rm helm-${HELM_VERSION}-${TARGETOS}-${TARGETARCH}.tar.gz && \ - rm -rf /usr/local/bin/${TARGETOS}-${TARGETARCH} - + rm -rf /usr/local/bin/${TARGETOS}-${TARGETARCH} && \ + helm plugin install https://github.com/helm/helm-mapkubeapis && \ + apk del git + +RUN curl -LO https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/${TARGETOS}/${TARGETARCH}/kubectl && \ + chmod +x ./kubectl && \ + mv ./kubectl /usr/local/bin/kubectl && \ + echo -e 'source /usr/share/bash-completion/bash_completion\nsource <(kubectl completion bash)' >>~/.bashrc + +RUN curl -SsLO https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/${KUSTOMIZE_VERSION}/kustomize_${KUSTOMIZE_VERSION}_${TARGETOS}_${TARGETARCH}.tar.gz && \ + tar xvzf kustomize_${KUSTOMIZE_VERSION}_${TARGETOS}_${TARGETARCH}.tar.gz && \ + mv kustomize /usr/local/bin/ && \ + rm kustomize_${KUSTOMIZE_VERSION}_${TARGETOS}_${TARGETARCH}.tar.gz COPY entrypoint.sh /usr/local/bin/entrypoint.sh