-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathDockerfile.base
More file actions
51 lines (42 loc) · 2 KB
/
Dockerfile.base
File metadata and controls
51 lines (42 loc) · 2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# https://alpinelinux.org/releases
FROM alpine:3.20
# https://github.com/kubernetes/kubernetes/releases
ARG KUBECTL_VERSION=1.30.3
# https://github.com/kubernetes-sigs/krew/releases
ARG KREW_VERSION=0.4.4
# https://github.com/ahmetb/kubectx/releases
ARG KUBECTX_VERSION=0.9.5
# https://github.com/helm/helm/releases
ARG HELM_VERSION=3.15.3
ENV KUBECONFIG="/root/.kube/config"
ENV KREW_ROOT="/root/.krew"
RUN echo "$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/')" > /tmp/bin-arch && cat /tmp/bin-arch
RUN apk upgrade --update && apk --no-cache add \
git \
github-cli \
make \
curl \
jq \
yq \
bash \
openssl
# kubectl
RUN curl -sSL "https://dl.k8s.io/release/v${KUBECTL_VERSION}/bin/linux/$(cat /tmp/bin-arch)/kubectl" -o /usr/local/bin/kubectl && \
curl -sSL "https://dl.k8s.io/v${KUBECTL_VERSION}/bin/linux/$(cat /tmp/bin-arch)/kubectl.sha256" -o /tmp/kubectl.sha256 && \
echo "$(cat /tmp/kubectl.sha256) /usr/local/bin/kubectl" | sha256sum -c && rm /tmp/kubectl.sha256 && \
chmod +x /usr/local/bin/kubectl && \
kubectl version --client --output=json
# krew and klock plugin
RUN TMPDIR="$(mktemp -d)" && \
curl -sSL "https://github.com/kubernetes-sigs/krew/releases/download/v${KREW_VERSION}/krew-linux_$(cat /tmp/bin-arch).tar.gz" | tar -xzf - -C ${TMPDIR} && \
"${TMPDIR}/krew-linux_$(cat /tmp/bin-arch)" install krew && \
rm -frv ${TMPDIR} && PATH="${KREW_ROOT}/bin:$PATH" && kubectl krew version && \
kubectl krew install klock
# kubectx and kubens
RUN curl -sSL "https://github.com/ahmetb/kubectx/releases/download/v${KUBECTX_VERSION}/kubectx_v${KUBECTX_VERSION}_linux_$(uname -m | sed 's/aarch64/arm64/').tar.gz" | tar -xzf - -C /usr/local/bin && \
curl -sSL "https://github.com/ahmetb/kubectx/releases/download/v${KUBECTX_VERSION}/kubens_v${KUBECTX_VERSION}_linux_$(uname -m | sed 's/aarch64/arm64/').tar.gz" | tar -xzf - -C /usr/local/bin
# helm
RUN curl -sSL "https://git.io/get_helm.sh" | bash -s -- --version "v${HELM_VERSION}" && \
helm version
COPY .bashrc /root/
CMD ["/bin/bash"]