Skip to content

Commit 228ddc7

Browse files
refactor: Change base image from ubuntu:18.04 to alpine:latest.
1 parent f711176 commit 228ddc7

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

Dockerfile

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,24 @@ RUN apk add --update git make && \
1212

1313

1414

15-
FROM ubuntu:18.04
15+
FROM alpine:latest
1616

1717
USER root
1818

19-
RUN rm -f /bin/sh && ln -s /bin/bash /bin/sh
2019
ENV KUBECTL_VERSION v1.20.2
2120
COPY --from=gotty-build /gotty /usr/bin/
2221
RUN ARCH=$(uname -m) && case $ARCH in aarch64) ARCH="arm64";; x86_64) ARCH="amd64";; esac && echo "ARCH: " $ARCH && \
23-
apt-get update && apt-get install -y --no-install-recommends curl ca-certificates jq iproute2 less bash-completion unzip sysstat acl net-tools iputils-ping telnet dnsutils wget vim git && \
22+
echo > /etc/apk/repositories && echo -e "https://dl-cdn.alpinelinux.org/alpine/latest-stable/main\nhttps://dl-cdn.alpinelinux.org/alpine/latest-stable/community" >> /etc/apk/repositories && \
23+
apk add --update --no-cache bash bash-completion curl git wget openssl iputils busybox-extras vim ncurses && sed -i "s/nobody:\//nobody:\/nonexistent/g" /etc/passwd && \
2424
curl -sLf https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/linux/${ARCH}/kubectl > /usr/bin/kubectl && chmod +x /usr/bin/kubectl && \
2525
git clone --branch v0.8.0 https://github.com/ahmetb/kubectx /opt/kubectx && chmod -R 755 /opt/kubectx && ln -s /opt/kubectx/kubectx /usr/local/bin/kubectx && ln -s /opt/kubectx/kubens /usr/local/bin/kubens && \
2626
git clone --branch master --depth 1 https://github.com/ahmetb/kubectl-aliases /opt/kubectl-aliases && chmod -R 755 /opt/kubectl-aliases && \
2727
git clone --branch 0.21.0 --depth 1 https://github.com/junegunn/fzf /opt/fzf && chmod -R 755 /opt/fzf && /opt/fzf/install && ln -s /opt/fzf/bin/fzf /usr/local/bin/fzf && \
2828
if [[ $ARCH == arm* ]]; then K9S_ARCH=arm64; else K9S_ARCH=x86_64; fi && echo $K9S_ARCH && \
2929
mkdir -p /tmp/k9s && cd /tmp/k9s && wget https://github.com/derailed/k9s/releases/download/v0.24.2/k9s_Linux_${K9S_ARCH}.tar.gz && tar -xvf k9s_Linux_${K9S_ARCH}.tar.gz && chmod +x k9s && mv k9s /usr/bin && \
3030
curl -L https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash && \
31-
chmod +x /usr/bin/gotty && chmod 500 /usr/bin/nohup && \
32-
DEBIAN_FRONTEND=noninteractive apt-get --purge remove -y git && \
33-
DEBIAN_FRONTEND=noninteractive apt-get autoremove -y && \
34-
DEBIAN_FRONTEND=noninteractive apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
31+
chmod +x /usr/bin/gotty && chmod 555 /bin/busybox && \
32+
apk del git && rm -rf /tmp/* /var/tmp/* /var/cache/apk/* && \
3533
chmod -R 755 /tmp && mkdir -p /opt/webkubectl
3634

3735
COPY vimrc.local /etc/vim

init-kubectl.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ mkdir -p /nonexistent
1212
mount -t tmpfs -o size=${SESSION_STORAGE_SIZE} tmpfs /nonexistent
1313
cd /nonexistent
1414
cp /root/.bashrc ./
15+
cp /etc/vim/vimrc.local .vimrc
1516
echo 'source /opt/kubectl-aliases/.kubectl_aliases' >> .bashrc
16-
echo 'PS1="> "' >> .bashrc
17+
echo -e 'PS1="> "\nalias ll="ls -la"' >> .bashrc
1718
mkdir -p .kube
1819

1920
export HOME=/nonexistent

start-webkubectl.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
echo "Environment variables:"
44
env
55

6-
echo "export TERM=xterm" >> /root/.bashrc
6+
echo "export TERM=xterm-256color" >> /root/.bashrc
77
echo "source /usr/share/bash-completion/bash_completion" >> /root/.bashrc
88
echo 'source <(kubectl completion bash)' >> /root/.bashrc
99
echo 'complete -F __start_kubectl k' >> /root/.bashrc

0 commit comments

Comments
 (0)