-
Notifications
You must be signed in to change notification settings - Fork 5
/
Dockerfile.ubuntu
222 lines (205 loc) · 9.84 KB
/
Dockerfile.ubuntu
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
FROM ubuntu:24.04
SHELL ["/bin/bash", "-x", "-c"]
ENV CLUSTER_DIR="/cluster" \
REPO_DIR="/repo" \
KREW_ROOT="/opt/krew" \
INSIDE_CONTAINER="true" \
LC_ALL="C.UTF-8" \
DEBIAN_FRONTEND="noninteractive"
ENV TERM="xterm-256color" \
DOCTL_VERSION="1.63.1" \
FLUX_VERSIONS="v0.15.3 v0.41.2 v2.3.0" \
GOOGLE_APPLICATION_CREDENTIALS="${CLUSTER_DIR}/service-account.json" \
HCL2JSON_VERSION="v0.3.3" \
HELM_PLUGINS="https://github.com/helm/helm-mapkubeapis" \
KIND_VERSION="v0.11.1" \
KREW_PLUGINS="access-matrix deprecations explore get-all kurt kvaps/node-shell lineage modify-secret outdated pexec score sniff tree" \
KREW_REPOS="kvaps@https://github.com/kvaps/krew-index" \
KREW_VERSION="v0.4.2" \
KUBECONFIG="${CLUSTER_DIR}/.kube/config" \
KUBELOGIN_VERSION="v0.1.3" \
OC_VERSION="4.11.0-0.okd-2022-12-02-145640" \
OSH="/etc/oh-my-bash" \
TERRAFORM_VERSION="1.9.4" \
TF_DATA_DIR="${CLUSTER_DIR}/.terraform" \
TF_IN_AUTOMATION="true" \
TF_LOG="INFO" \
TF_LOG_PROVIDER="INFO" \
TF_LOG_CORE="WARN" \
TF_LOG_PATH="${CLUSTER_DIR}/terraform.log" \
TF_PLAN_FILE="${CLUSTER_DIR}/terraform.tfplan" \
TF_VARS_FILE="${CLUSTER_DIR}/terraform.tfvars" \
VELERO_VERSION="1.13.2" \
PATH="/pyenv/bin:$PATH:$KREW_ROOT/bin" \
TELEPORT_EDITION="cloud" \
TELEPORT_DOMAIN="example.teleport.sh" \
TELEPORT_VERSION="14.3.19"
WORKDIR $CLUSTER_DIR
RUN apt update && \
apt install -y \
apache2-utils \
bc \
binutils \
cargo \
curl \
dialog \
dnsutils \
gawk \
gettext \
git \
iproute2 \
iputils-ping \
iputils-tracepath \
jq \
libffi-dev \
libssl-dev \
make \
netcat-openbsd \
net-tools \
nmap \
pv \
python3.12 \
python3.12-venv \
python3-full \
python3-dev \
rsync \
rustc \
sshpass \
strace \
sudo \
time \
traceroute \
tree \
unzip \
vim \
&& apt-get clean && apt-get autoclean
# https://goteleport.com/docs/installation/
RUN curl https://goteleport.com/static/install.sh | bash -s ${TELEPORT_VERSION} ${TELEPORT_EDITION}
# https://github.com/cli/cli/blob/trunk/docs/install_linux.md
RUN (type -p wget >/dev/null || (sudo apt update && sudo apt-get install wget -y)) \
&& sudo mkdir -p -m 755 /etc/apt/keyrings \
&& wget -qO- https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \
&& sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& sudo apt update \
&& sudo apt install gh -y \
&& apt-get clean && apt-get autoclean
RUN python3 -m venv /pyenv && \
chmod o+w -R /pyenv && \
source /pyenv/bin/activate && \
pip3 install giturlparse pyyaml ruamel-yaml python-hcl2==3.0.5 && \
curl -Lv https://github.com/junegunn/fzf/releases/download/0.29.0/fzf-0.29.0-linux_amd64.tar.gz \
| sudo tar xzvf - -C /usr/local/bin && \
curl -Lv https://github.com/Wilfred/difftastic/releases/download/0.27.0/difft-x86_64-unknown-linux-gnu.tar.gz \
| sudo tar xzvf - -C /usr/local/bin && \
curl -s https://raw.githubusercontent.com/terraform-linters/tflint/master/install_linux.sh | bash
#RUN curl -kLO https://cache.agilebits.com/dist/1P/op/pkg/v1.12.3/op_linux_amd64_v1.12.3.zip && \
# unzip op_linux_amd64_v1.12.3.zip -d /usr/local/bin && \
# rm -f op_linux_amd64_v1.12.3.zip
#RUN curl -skL https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.sh > /etc/oci-install.sh && \
# chmod +x /etc/oci-install.sh && \
# /etc/oci-install.sh --accept-all-defaults \
# --install-dir /opt/oci \
# --exec-dir /usr/local/bin/ \
# --script-dir /usr/local/bin/ \
# --rc-file-path /etc/profile.d/oci.sh && \
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \
unzip awscliv2.zip && \
sudo ./aws/install && \
rm -rf aws awscliv2.zip && \
aws --version
RUN cd /usr/local/bin && \
curl -skLO https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip && \
unzip terraform_${TERRAFORM_VERSION}_linux_amd64.zip && \
rm -f terraform_${TERRAFORM_VERSION}_linux_amd64.zip && \
curl -skL https://github.com/mikefarah/yq/releases/download/v4.13.2/yq_linux_amd64 > yq && \
KERNEL_MACHINE=$(uname | tr '[:upper:]' '[:lower:]')-$(uname -m | sed -e 's/x86_64/amd64/' -e 's/arm.*$/arm/' -e 's/aarch64/arm64/') && \
curl -skL https://kind.sigs.k8s.io/dl/v0.11.1/kind-${KERNEL_MACHINE} > kind && \
curl -skL https://github.com/tmccombs/hcl2json/releases/download/v0.3.4/hcl2json_linux_amd64 > hcl2json && \
curl -skL https://github.com/kubernetes-sigs/aws-iam-authenticator/releases/download/v0.5.27/aws-iam-authenticator_0.5.27_linux_amd64 > \
aws-iam-authenticator && \
curl -skL https://github.com/derailed/k9s/releases/download/v0.32.5/k9s_Linux_amd64.tar.gz | tar xzvf - k9s && \
curl -skL https://github.com/ahmetb/kubectx/releases/download/v0.9.3/kubectx > kubectx && \
curl -skL https://github.com/ahmetb/kubectx/releases/download/v0.9.3/kubens > kubens && \
curl -skL https://raw.githubusercontent.com/ahmetb/kubectl-aliases/master/.kubectl_aliases > /etc/profile.d/kubectl_aliases.sh && \
curl -skL https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash && \
curl -skL https://run.linkerd.io/install | INSTALLROOT=/usr/local bash && \
curl -skL https://github.com/openshift/okd/releases/download/${OC_VERSION}/openshift-client-linux-${OC_VERSION}.tar.gz \
| tar xzvf - oc && \
KUBECTL_VERSIONS=$( \
curl -s https://api.github.com/repos/kubernetes/kubernetes/releases?per_page=100 \
| jq -r '.[] | .tag_name' \
| grep '^v[0-9]\.[0-9][0-9]\?\.[0-9][0-9]\?$' \
| sort -Vr \
| awk -F . '!a[$1 FS $2]++' \
| sort -V) && \
for KUBECTL_VERSION in $KUBECTL_VERSIONS; do \
curl -skL https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl > \
kubectl_${KUBECTL_VERSION}; \
done && \
ln -s kubectl_$KUBECTL_VERSION kubectl && \
ln -s ${KUBECONFIG%/*} /root/.kube && \
for FLUX_VERSION in $FLUX_VERSIONS; do \
curl -skL https://github.com/fluxcd/flux2/releases/download/${FLUX_VERSION}/flux_${FLUX_VERSION:1}_linux_amd64.tar.gz \
| tar xzv --transform="s,.*,flux-$FLUX_VERSION,"; \
done && \
ln -s flux-$FLUX_VERSION flux && \
curl -skL https://github.com/digitalocean/doctl/releases/download/v$DOCTL_VERSION/doctl-$DOCTL_VERSION-linux-amd64.tar.gz \
| tar xzv doctl && \
curl -skL https://github.com/vmware-tanzu/velero/releases/download/v${VELERO_VERSION}/velero-v${VELERO_VERSION}-linux-amd64.tar.gz \
| tar xzv --strip-components=1 velero-v${VELERO_VERSION}-linux-amd64/velero && \
curl -Lv https://github.com/mozilla/sops/releases/download/v3.8.1/sops-v3.8.1.linux > sops && \
\
curl -skL https://raw.github.com/ohmybash/oh-my-bash/master/tools/install.sh > oh-my-bash.install && \
chmod +x oh-my-bash.install && \
echo "Execute 'oh-my-bash.install' to install OH-MY-BASH" && \
curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash && \
curl -kL https://gist.github.com/caruccio/3fe4cb8949419b093c5c5c9b3ac33631/raw/97915ca848e6e5689868c9fa00c3412479e2f9c3/kubectl-extract \
-o /usr/local/bin/kubectl-extract && \
curl -OkL https://github.com/Azure/kubelogin/releases/download/${KUBELOGIN_VERSION}/kubelogin-linux-amd64.zip && \
unzip kubelogin-linux-amd64.zip && mv bin/linux_amd64/kubelogin ./ && rm -rf bin kubelogin-linux-amd64.zip && \
chmod +x /usr/local/bin/kubectl-extract && \
chmod -R +x /usr/local/bin
RUN KERNEL_MACHINE=$(uname | tr '[:upper:]' '[:lower:]')_$(uname -m | sed -e 's/x86_64/amd64/' -e 's/arm.*$/arm/' -e 's/aarch64/arm64/') && \
curl -skL https://github.com/kubernetes-sigs/krew/releases/download/${KREW_VERSION}/krew-${KERNEL_MACHINE}.tar.gz \
| tar xzv ./krew-${KERNEL_MACHINE} && \
mv krew-${KERNEL_MACHINE} /usr/local/bin/krew && \
krew install krew && \
ln -s /usr/local/bin/krew /usr/local/bin/kubectl-krew && \
for repo in ${KREW_REPOS}; do \
kubectl krew index add ${repo%%@*} ${repo##*@}; \
done && \
for plugin in ${KREW_PLUGINS}; do \
kubectl krew install $plugin; \
done && \
chmod -R 777 $KREW_ROOT && \
for plugin in ${HELM_PLUGINS}; do \
helm plugin install $plugin; \
done
RUN cd /etc/profile.d && \
curl -skL https://raw.githubusercontent.com/jonmosco/kube-ps1/master/kube-ps1.sh > bash_ps1_kubernetes.sh && \
chmod +x bash_ps1_kubernetes.sh && \
curl -skL https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh > bash_ps1_git.sh && \
chmod +x bash_ps1_git.sh && \
kubectl completion bash > kubectl_completion.sh && \
chmod +x kubectl_completion.sh && \
cd /opt && \
wget https://github.com/caruccio/autokube/archive/refs/heads/main.zip && \
unzip main.zip && \
rm -f main.zip && \
cd autokube-main && \
make install && \
git clone https://github.com/caruccio/kubectl-plugins && \
install -m 755 kubectl-plugins/kubectl-* /usr/local/bin/
ARG GIT_COMMIT
ARG VERSION
ARG RELEASE
RUN echo $VERSION > /.version && \
echo $RELEASE > /.release && \
echo $GIT_COMMIT > /.gitcommit && \
rsync /etc/skel/ /root/ && \
chmod 777 /usr/share
COPY root/ /
COPY root/etc/skel/ /root/
COPY Dockerfile.ubuntu /
ENTRYPOINT ["/usr/local/bin/entrypoint"]