-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
63 lines (50 loc) · 2.03 KB
/
Dockerfile
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
52
53
54
55
56
57
58
59
60
61
62
63
FROM gcr.io/kubernetes-helm/tiller:v2.14.3 as helm
FROM bitnami/kubectl:1.13.4 as kubectl
FROM velero/velero:v1.1.0 as velero
FROM ubuntu:bionic
RUN apt-get update -y && apt-get install -yqq wget curl git bash-completion
# kubectl
COPY --from=kubectl /opt/bitnami/kubectl/bin/kubectl /usr/local/bin/kubectl
# helm
COPY --from=helm /helm /usr/local/bin/helm
# velero
COPY --from=velero /velero /usr/local/bin/velero
# kube-ps1
RUN ( \
set -x; cd "$(mktemp -d)" && \
curl -sS -fsSLO -o - "https://raw.githubusercontent.com/jonmosco/kube-ps1/master/kube-ps1.sh" && \
mv kube-ps1.sh /etc/profile.d/99-kubeps1.sh \
)
# stern
RUN ( \
set -x; cd "$(mktemp -d)" && \
curl -fsSLO "https://github.com/wercker/stern/releases/download/1.11.0/stern_linux_amd64" && \
mv stern_linux_amd64 /usr/local/bin/stern && \
chmod a+x /usr/local/bin/stern \
)
RUN (\
set -x; cd "$(mktemp -d)" && \
curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" \
| bash && \
mv kustomize /usr/local/bin/ \
)
COPY 99-k8s-extras.sh /etc/profile.d/99-k8s-extras.sh
RUN addgroup --gid 1000 cicd && adduser --shell /bin/bash --uid 1000 --gid 1000 --gecos '' --disabled-password cicd
USER cicd
# krew / kubens / kubectx (user level)
RUN ( \
set -x; cd "$(mktemp -d)" && \
curl -fsSLO "https://github.com/kubernetes-sigs/krew/releases/download/v0.3.3/krew.{tar.gz,yaml}" && \
tar zxvf krew.tar.gz && \
./krew-"$(uname | tr '[:upper:]' '[:lower:]')_amd64" install \
--manifest=krew.yaml --archive=krew.tar.gz \
)
# make helm ready for use
RUN helm init --client-only && \
helm repo remove local && \
helm repo add incubator https://storage.googleapis.com/kubernetes-charts-incubator && \
helm repo update
RUN bash -l -c 'kubectl krew update && kubectl krew install ctx && kubectl krew install ns'
RUN echo 'source /etc/profile.d/99-k8s-extras.sh' >> /home/cicd/.bashrc
VOLUME /code
WORKDIR /code