Skip to content

Commit

Permalink
Merge pull request #14 from smartcat999/update-kubectl-Dockerfile
Browse files Browse the repository at this point in the history
feat: support helm plugin mapkubeapis
  • Loading branch information
wansir authored Mar 13, 2024
2 parents 7ed86ef + 5eaa068 commit 338bf9d
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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

Expand Down

0 comments on commit 338bf9d

Please sign in to comment.