From bf9ab35a05ed9f0e468e216d87cebc840038140b Mon Sep 17 00:00:00 2001 From: Jan Lauber Date: Mon, 6 Nov 2023 10:15:57 +0100 Subject: [PATCH] feat: add kubectl and other extensions Signed-off-by: Jan Lauber --- .gitignore | 1 + Dockerfile | 29 ++++++++++++++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 3b735ec..712a58a 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,4 @@ # Go workspace file go.work +docker-code-server/ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index d89a829..0d498c5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,4 +17,31 @@ RUN sed -i 's/abc/kubelab-agent/g' /usr/local/bin/install-extension RUN sed -i 's/abc/kubelab-agent/g' /etc/s6-overlay/s6-rc.d/svc-code-server/run # add --disable-workspace-trust to the exec of /etc/s6-overlay/s6-rc.d/svc-code-server/run -RUN sed -i '/\/app\/code-server\/bin\/code-server/a \\\t\t\t\t--disable-workspace-trust true \\' /etc/s6-overlay/s6-rc.d/svc-code-server/run \ No newline at end of file +RUN sed -i '/\/app\/code-server\/bin\/code-server/a \\\t\t\t\t--disable-workspace-trust true \\' /etc/s6-overlay/s6-rc.d/svc-code-server/run + +# install kubernetes vs code extension +RUN /app/code-server/bin/code-server --install-extension ms-kubernetes-tools.vscode-kubernetes-tools --extensions-dir /config/extensions + +# Installing kubectl +RUN curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" && \ + chmod +x ./kubectl && \ + mv ./kubectl /usr/local/bin/kubectl + +# Installing helm +RUN curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 && \ + chmod +x ./get_helm.sh && \ + ./get_helm.sh && \ + rm ./get_helm.sh + +# Installing kustomize +RUN curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash && \ + mv ./kustomize /usr/local/bin/kustomize + +# Autocompletion for kubectl +RUN echo 'source <(kubectl completion bash)' >>/config/.bashrc +RUN echo 'alias k=kubectl' >>/config/.bashrc + +# Autocompletion for helm +RUN echo 'source <(helm completion bash)' >>/config/.bashrc + +RUN echo 'export PS1="\[\033[01;34m\]\u\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\\$ "' >> /config/.bashrc \ No newline at end of file