-
Notifications
You must be signed in to change notification settings - Fork 46
/
dockerfile
117 lines (93 loc) · 4.43 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
FROM python:3.10-alpine
#Some Tools
RUN apk add --no-cache curl bash-completion ncurses-terminfo-base ncurses-terminfo readline ncurses-libs bash nano ncurses docker git
#Google Kubernetes control cmd
RUN curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
RUN chmod +x ./kubectl
RUN mv ./kubectl /usr/local/bin/kubectl
#Expose for kubectl proxy
EXPOSE 8001
#K8 Helm
RUN wget -q "https://get.helm.sh/helm-v3.14.4-linux-amd64.tar.gz" -O helm.tar.gz && \
tar -xzf helm.tar.gz && \
rm helm.tar.gz && \
mv linux-amd64/helm /usr/local/bin/helm
# Kubens \ Kubectx
RUN curl -L https://github.com/ahmetb/kubectx/archive/v0.4.0.tar.gz | tar xz \
&& cd ./kubectx-0.4.0 \
&& mv kubectx kubens utils.bash /usr/local/bin/ \
&& chmod +x /usr/local/bin/kubectx \
&& chmod +x /usr/local/bin/kubens \
&& cat completion/kubectx.bash >> ~/.bashrc \
&& cat completion/kubens.bash >> ~/.bashrc \
&& cd ../ \
&& rm -fr ./kubectx-0.4.0
#Cloudfare SSL Tools
RUN curl -L https://github.com/cloudflare/cfssl/releases/download/v1.5.0/cfssl_1.5.0_linux_amd64 -o /usr/local/bin/cfssl && \
curl -L https://github.com/cloudflare/cfssl/releases/download/v1.5.0/cfssljson_1.5.0_linux_amd64 -o /usr/local/bin/cfssljson && \
chmod +x /usr/local/bin/cfssl && \
chmod +x /usr/local/bin/cfssljson
#Syntax highlighting
RUN git clone https://github.com/scopatz/nanorc.git ~/.nano && \
echo "include ~/.nano/*.nanorc" >> ~/.nanorc && \
rm ~/.nano/hcl.nanorc && rm /root/.nano/prolog.nanorc #These cause errors-remove them
#Azure CLI
WORKDIR azure-cli
ENV AZ_CLI_VERSION=2.61.0
#Download the version we want!
RUN wget -q "https://github.com/Azure/azure-cli/archive/azure-cli-${AZ_CLI_VERSION}.tar.gz" -O azcli.tar.gz && \
tar -xzf azcli.tar.gz && ls -l
RUN cp azure-cli-azure-cli-${AZ_CLI_VERSION}/** /azure-cli/ -r && \
rm azcli.tar.gz
RUN apk add --no-cache bash openssh ca-certificates jq curl openssl perl git zip \
&& apk add --no-cache --virtual .build-deps gcc make openssl-dev libffi-dev musl-dev linux-headers \
&& apk add --no-cache libintl icu-libs libc6-compat \
&& apk add --no-cache bash-completion \
&& update-ca-certificates
ARG JP_VERSION="0.1.3"
RUN curl -L https://github.com/jmespath/jp/releases/download/${JP_VERSION}/jp-linux-amd64 -o /usr/local/bin/jp \
&& chmod +x /usr/local/bin/jp
# 1. Build packages and store in tmp dir
# 2. Install the cli and the other command modules that weren't included
RUN ./scripts/install_full.sh \
&& cat /azure-cli/az.completion > ~/.bashrc \
&& runDeps="$( \
scanelf --needed --nobanner --recursive /usr/local \
| awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
| sort -u \
| xargs -r apk info --installed \
| sort -u \
)" \
&& apk add --virtual .rundeps $runDeps
# Remove CLI source code from the final image and normalize line endings.
RUN rm -rf ./azure-cli && \
dos2unix /root/.bashrc /usr/local/bin/az
ENV AZ_INSTALLER=DOCKER
# Tab completion
#RUN cat /azure-cli/az.completion >> ~/.bashrc
#RUN echo -e "\n" >> ~/.bashrc
RUN echo -e "source <(kubectl completion bash)" >> ~/.bashrc
RUN echo "source /etc/profile.d/bash_completion.sh" >> ~/.bashrc
#Azure kubelogin
RUN curl -L https://github.com/Azure/kubelogin/releases/download/v0.0.13/kubelogin-linux-amd64.zip -o /tmp/kubelogin.zip && \
unzip /tmp/kubelogin.zip -d /tmp/ && \
mv /tmp/bin/linux_amd64/kubelogin /usr/local/bin/kubelogin && \
chmod +X /usr/local/bin/kubelogin
# Kube-ps1 - order so we can change themes without pulling kubeps1 every build
RUN curl -L https://github.com/jonmosco/kube-ps1/archive/0.6.0.tar.gz | tar xz && \
cd ./kube-ps1-0.6.0 && \
mkdir -p ~/kube-ps1 && \
mv kube-ps1.sh ~/kube-ps1/ && \
rm -fr ./kube-ps1-0.6.0
COPY kubeps1.sh /root/kube-ps1/
RUN chmod +x ~/kube-ps1/*.sh && \
echo "source ~/kube-ps1/kube-ps1.sh" >> ~/.bashrc && \
echo "source ~/kube-ps1/kubeps1.sh" >> ~/.bashrc && \
echo "PROMPT_COMMAND=\"my_kube_ps1\"" >> ~/.bashrc
# Aliases
RUN echo "alias k=kubectl" >> ~/.bashrc
RUN echo "alias kubedev=\"export KUBECONFIG=~/.kube/dev-config\"" >> ~/.bashrc
RUN echo "alias kubeprod=\"export KUBECONFIG=~/.kube/production-config\"" >> ~/.bashrc
ENV KUBE_EDITOR nano
WORKDIR /
ENTRYPOINT ["bash"]