forked from ContainerCraft/devcontainer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
417 lines (382 loc) · 13.9 KB
/
Dockerfile
File metadata and controls
417 lines (382 loc) · 13.9 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
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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
# docker run --rm --publish 2222:2222 --publish 7681:7681 --publish 8088:8080 -d --name konductor --hostname konductor ghcr.io/containercraft/konductor
# podman run -d --rm --cap-add=CAP_AUDIT_WRITE --publish 2222:2222 --publish 7681:7681 --publish 8088:8080 --name konductor --hostname konductor --security-opt label=disable --pull=always ghcr.io/containercraft/konductor
###############################################################################
# Builder Image
FROM quay.io/fedora/fedora:37 as builder
###############################################################################
# DNF Package List
ARG DNF_LIST="\
xz \
bc \
mc \
dnf \
vim \
git \
tar \
mosh \
sudo \
file \
wget \
tree \
tmux \
pigz \
fish \
bash \
curl \
tmate \
which \
glibc \
rsync \
unzip \
pipenv \
netcat \
psmisc \
passwd \
skopeo \
bsdtar \
sqlite \
golang \
plocate \
ripgrep \
iputils \
tcpdump \
dnsutils \
pciutils \
findutils \
procps-ng \
net-tools \
nmap-ncat \
bind-utils \
httpd-tools \
podman-remote \
openssh-server \
libvarlink-util \
bash-completion \
glibc-langpack-en \
glibc-locale-source \
python3-pip \
python3 \
fira-code-fonts \
powerline-fonts \
tmux-powerline \
starship \
"
# glibc-all-langpacks \
ARG PIP_LIST="\
k8s \
passlib \
ansible \
github3.py \
kubernetes \
"
###############################################################################
# DNF Package Install Flags
ARG DNF_FLAGS="\
-y \
--releasever 37 \
--installroot /rootfs \
"
ARG DNF_FLAGS_EXTRA="\
--nodocs \
--exclude container-selinux \
--setopt=install_weak_deps=false \
${DNF_FLAGS} \
"
###############################################################################
# Build Rootfs
ARG BUILD_PATH=/rootfs
RUN set -ex \
&& dnf -y install 'dnf-command(copr)' \
&& dnf copr enable -y atim/starship \
&& mkdir -p ${BUILD_PATH} \
&& dnf install ${DNF_FLAGS_EXTRA} ${DNF_LIST} \
&& dnf -y install ${DNF_FLAGS_EXTRA} 'dnf-command(copr)' \
&& dnf clean all ${DNF_FLAGS} \
&& rm -rf \
${BUILD_PATH}/var/cache/* \
${BUILD_PATH}/var/log/dnf* \
${BUILD_PATH}/var/log/yum* \
&& echo
#################################################################################
# Create image from rootfs
FROM scratch
COPY --from=builder /rootfs /
ADD ./rootfs/ /
RUN set -ex \
&& localedef -i en_US -f UTF-8 en_US.UTF-8 \
&& ln /usr/bin/vim /usr/bin/vi \
&& echo
# Install NerdFonts FiraCode
RUN set -ex \
&& curl -LO https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/FiraCode.zip \
&& sudo unzip FiraCode.zip -d /usr/share/fonts/NerdFonts \
&& rm -rf FiraCode.zip \
&& echo
#################################################################################
# Install screenfetch
RUN set -ex \
&& export varUrlScreenfetch="https://git.io/vaHfR" \
&& curl --output /usr/bin/screenfetch -L ${varUrlScreenfetch} \
&& chmod +x /usr/bin/screenfetch \
&& /usr/bin/screenfetch \
&& echo
# Install clusterctl
RUN set -ex \
&& export varVerCapi=$(curl -s https://api.github.com/repos/kubernetes-sigs/cluster-api/releases/latest | awk -F '["v,]' '/tag_name/{print $5}') \
&& export varUrlCapi="https://github.com/kubernetes-sigs/cluster-api/releases/download/v${varVerCapi}/clusterctl-linux-amd64" \
&& curl --output /usr/bin/clusterctl -L ${varUrlCapi} \
&& chmod +x /usr/bin/clusterctl \
&& /usr/bin/clusterctl version \
&& echo
# Install k9scli.io
RUN set -ex \
&& export varVerK9s="$(curl -s https://api.github.com/repos/derailed/k9s/releases/latest | awk -F '[\"v,]' '/tag_name/{print $5}')" \
&& export varUrlK9s="https://github.com/derailed/k9s/releases/download/v${varVerK9s}/k9s_Linux_x86_64.tar.gz" \
&& curl -L ${varUrlK9s} \
| tar xzvf - --directory /usr/bin k9s \
&& chmod +x /usr/bin/k9s \
&& /usr/bin/k9s version \
&& echo
# Install kumactl cli
RUN set -ex \
&& export varVerKuma="$(curl -s https://api.github.com/repos/kumahq/kuma/releases/latest | awk -F '[\"v,]' '/tag_name/{print $4}')" \
&& export varUrlKuma="https://download.konghq.com/mesh-alpine/kuma-kumactl-${varVerKuma}-linux-amd64.tar.gz" \
&& curl -L ${varUrlKuma} | tar xzvf - --directory /tmp \
&& mv /tmp/kuma-${varVerKuma}/bin/kumactl /usr/bin/kumactl \
&& rm -rf /tmp/kuma-${varVerKuma} \
&& chmod +x /usr/bin/kumactl \
&& /usr/bin/kumactl version \
&& echo
# Insall helm cli
RUN set -ex \
&& export varVerHelm="$(curl -s https://api.github.com/repos/helm/helm/releases/latest | awk -F '[\"v,]' '/tag_name/{print $5}')" \
&& export varUrlHelm="https://get.helm.sh/helm-v${varVerHelm}-linux-amd64.tar.gz" \
&& curl -L ${varUrlHelm} | tar xzvf - --directory /tmp linux-amd64/helm \
&& mv /tmp/linux-amd64/helm /bin/helm \
&& rm -rf /tmp/linux-amd64 \
&& chmod +x /bin/helm \
&& /bin/helm version \
&& echo
# Add Pulumi binary
RUN set -ex \
&& export urlPulumiRelease="https://api.github.com/repos/pulumi/pulumi/releases/latest" \
&& export urlPulumiVersion=$(curl -s ${urlPulumiRelease} | awk -F '["v,]' '/tag_name/{print $5}') \
&& export urlPulumiBase="https://github.com/pulumi/pulumi/releases/download" \
&& export urlPulumiBin="pulumi-v${urlPulumiVersion}-linux-x64.tar.gz" \
&& export urlPulumi="${urlPulumiBase}/v${urlPulumiVersion}/${urlPulumiBin}" \
&& curl -L ${urlPulumi} \
| tar xzvf - --directory /tmp \
&& mv /tmp/pulumi/* /usr/local/bin/ \
&& rm -rf /tmp/pulumi \
&& pulumi version \
&& echo
# Install openshift client "oc"
RUN set -ex \
&& export varVerOpenshift="$(curl --silent https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest/release.txt | awk '/ Version/{print $2}')" \
&& export varUrlOpenshift="https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest/openshift-client-linux-${varVerOpenshift}.tar.gz" \
&& curl -L ${varUrlOpenshift} \
| tar xzvf - --directory /bin oc kubectl \
&& chmod +x /bin/oc /bin/kubectl \
&& /bin/oc version --client \
&& echo
# Install Krew
RUN set -ex \
&& export varVerKrew=$(curl -s https://api.github.com/repos/kubernetes-sigs/krew/releases/latest | awk -F '["v,]' '/tag_name/{print $5}') \
&& export varUrlKrew="https://github.com/kubernetes-sigs/krew/releases/download/v${varVerKrew}/krew-linux_amd64.tar.gz" \
&& curl -L ${varUrlKrew} \
| tar xzvf - --directory /bin ./krew-linux_amd64 \
&& mv /bin/krew-linux_amd64 /bin/kubectl-krew \
&& chmod +x /bin/kubectl-krew \
&& /bin/kubectl krew version \
&& echo
# Install UOR Client
RUN set -ex \
&& export varVerUor=$(curl -s https://api.github.com/repos/uor-framework/uor-client-go/releases/latest | awk -F '["v,]' '/tag_name/{print $5}') \
&& export varUrlUor="https://github.com/uor-framework/uor-client-go/releases/download/v${varVerUor}/uor-client-go-linux-amd64" \
&& curl -L ${varUrlUor} -o /usr/bin/uor-client-go \
&& chmod +x /usr/bin/uor-client-go \
&& /usr/bin/uor-client-go version \
&& echo
# Install virtctl
RUN set -ex \
&& export varVerKubevirt=$(curl -s https://api.github.com/repos/kubevirt/kubevirt/releases/latest | awk -F '["v,]' '/tag_name/{print $5}') \
&& export varUrlKubevirt="https://github.com/kubevirt/kubevirt/releases/download/v${varVerKubevirt}/virtctl-v${varVerKubevirt}-linux-amd64" \
&& curl -L ${varUrlKubevirt} -o /bin/virtctl \
&& chmod +x /bin/virtctl \
&& /bin/virtctl version --client \
&& echo
# Install jq
RUN set -ex \
&& export varVerJq=$(curl -s https://api.github.com/repos/stedolan/jq/releases/latest | awk -F '["jq-]' '/tag_name/{print $7}') \
&& export varUrlJq="https://github.com/stedolan/jq/releases/download/jq-${varVerJq}/jq-linux64" \
&& curl -L ${varUrlJq} -o /bin/jq \
&& chmod +x /bin/jq \
&& /bin/jq --version \
&& echo
# Install yq
RUN set -ex \
&& export varVerYq=$(curl -s https://api.github.com/repos/mikefarah/yq/releases/latest | awk -F '["v,]' '/tag_name/{print $5}') \
&& export varUrlYq="https://github.com/mikefarah/yq/releases/download/v${varVerYq}/yq_linux_amd64" \
&& curl -L ${varUrlYq} -o /bin/yq \
&& chmod +x /bin/yq \
&& /bin/yq --version \
&& echo
# Install grpcurl
RUN set -ex \
&& export varVerGrpcurl=$(curl -s https://api.github.com/repos/fullstorydev/grpcurl/releases/latest | awk -F '["v,]' '/tag_name/{print $5}') \
&& export varUrlGrpcurl="https://github.com/fullstorydev/grpcurl/releases/download/v${varVerGrpcurl}/grpcurl_${varVerGrpcurl}_linux_x86_64.tar.gz" \
&& curl -L ${varUrlGrpcurl} \
| tar xzvf - --directory /bin grpcurl \
&& chmod +x /bin/grpcurl \
&& /bin/grpcurl --version \
&& echo
# Install talosctl
RUN set -ex \
&& export varVerTalos=$(curl -s https://api.github.com/repos/siderolabs/talos/releases/latest | awk -F '["v,]' '/tag_name/{print $5}') \
&& export varUrlTalos="https://github.com/siderolabs/talos/releases/download/v${varVerTalos}/talosctl-linux-amd64" \
&& curl --output /usr/bin/talosctl -L ${varUrlTalos} \
&& chmod +x /usr/bin/talosctl \
&& /usr/bin/talosctl version --client \
&& echo
# Install ttyd
RUN set -ex \
&& export varVerTtyd=$(curl -s https://api.github.com/repos/tsl0922/ttyd/releases/latest | awk -F '[":,]' '/tag_name/{print $5}') \
&& export varUrlTtyd="https://github.com/tsl0922/ttyd/releases/download/${varVerTtyd}/ttyd.x86_64" \
&& curl -L ${varUrlTtyd} --output /bin/ttyd \
&& chmod +x /bin/ttyd \
&& /bin/ttyd --version \
&& echo
# Install VSCode Service
RUN set -ex \
&& export varVerCode=$(curl -s https://api.github.com/repos/coder/code-server/releases/latest | awk -F '["v,]' '/tag_name/{print $5}') \
&& dnf install -y "https://github.com/coder/code-server/releases/download/v${varVerCode}/code-server-${varVerCode}-amd64.rpm" \
&& dnf clean all \
&& rm -rf \
${BUILD_PATH}/var/cache/* \
${BUILD_PATH}/var/log/dnf* \
${BUILD_PATH}/var/log/yum* \
&& echo
#################################################################################
# Load startup artifacts
COPY ./bin/code.entrypoint /bin/
COPY ./bin/connect /bin/
COPY ./bin/entrypoint /bin/
#################################################################################
# Alias podman-remote to podman
RUN set -ex \
&& ln /usr/bin/podman-remote /usr/bin/podman \
&& echo
# Create User
RUN set -ex \
RUN set -ex \
&& groupadd --system sudo \
&& mkdir -p /etc/sudoers.d \
&& echo "%sudo ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers.d/sudo \
&& echo "%root ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers.d/root \
&& groupadd -g 1000 k \
&& useradd -m -u 1000 -g 1000 -s /usr/bin/fish --groups users,sudo k \
&& chmod 0775 /usr/local/lib \
&& chgrp users /usr/local/lib \
&& mkdir /usr/local/lib/node_modules \
&& chown -R k:k \
/usr/local/lib/node_modules \
/var/local \
&& echo
# Set User
USER k
WORKDIR /home/k
# Install OMF
RUN set -ex \
&& git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim \
&& vim -E -u NONE -S ~/.vimrc +PluginInstall +qall \
&& echo
# && vim -T dumb -n -i NONE -es -S <(echo -e "silent! PluginInstall\nqall") \
# Install OMF
RUN set -ex \
&& curl --output install -L https://raw.githubusercontent.com/oh-my-fish/oh-my-fish/master/bin/install \
&& fish -c '. install --noninteractive' \
&& rm install \
&& echo
# configure User
RUN set -x \
&& vim -T dumb -n -i NONE -es -S <(echo -e "silent! PluginInstall\nqall") \
&& echo
RUN set -x \
&& kubectl krew install \
view-utilization \
view-secret \
view-cert \
rook-ceph \
open-svc \
whoami \
konfig \
virt \
ktop \
neat \
tail \
ctx \
ns \
&& ~/.tmux/plugins/tpm/bin/install_plugins || true \
&& echo
RUN set -ex \
&& code-server --install-extension vscodevim.vim \
&& code-server --install-extension redhat.vscode-yaml \
&& code-server --install-extension esbenp.prettier-vscode \
&& code-server --install-extension oderwat.indent-rainbow \
&& code-server --install-extension tabnine.tabnine-vscode \
&& code-server --install-extension zhuangtongfa.Material-theme \
&& code-server --install-extension ms-kubernetes-tools.vscode-kubernetes-tools \
&& echo
#################################################################################
# Entrypoint & default command
ENTRYPOINT /bin/entrypoint
CMD ["/usr/bin/env", "connect"]
# Ports
# - ssh
# - mosh
# - TTYd
# - VSCode
EXPOSE 2222
EXPOSE 6000
EXPOSE 7681
EXPOSE 8080
#################################################################################
# Finalize Image
MAINTAINER "github.com/containercraft"
ENV \
BUILDAH_ISOLATION=chroot \
XDG_CONFIG_HOME=/home/k/.config \
REGISTRY_AUTH_FILE='/root/.docker/config.json' \
PATH="/home/k/.krew/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/.local/bin"
LABEL \
license=GPLv3 \
name="konductor" \
distribution-scope="public" \
io.k8s.display-name="konductor" \
summary="CCIO Konductor Cloud Bastion" \
io.openshift.tags="containercraft,konductor" \
description="CCIO Konductor Cloud Bastion" \
io.k8s.description="CCIO Konductor Cloud Bastion"
LABEL org.opencontainers.image.source https://github.com/containercraft/konductor
LABEL org.opencontainers.image.description "Konductor is as a multi-function operator and developer bastion.\
Included:\
- Fish Shell\
- Starship prompt by starship.rs\
- VS Code Server by coder.com\
- TTYd Terminal Server\
- SSH Server\
- SSH\
- Tmux\
- Tmate\
- Helm\
- K9s\
- Kubectl\
- Kumactl\
- VirtCtl\
- GRPCurl\
- Pulumi\
- Talosctl\
- Skopeo\
- Jq\
- Yq\
"