Skip to content

Commit

Permalink
added k8s image
Browse files Browse the repository at this point in the history
  • Loading branch information
agschrei committed Jun 15, 2021
1 parent 6b491f2 commit f24a4fa
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 9 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,14 @@ jobs:
- name: login docker hub
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
# Runs a set of commands using the runners shell
- name: build image
- name: build base image
run: |
docker buildx build --push \
--tag agschrei/productivity-images:base \
--platform linux/amd64,linux/arm64 base
- name: build k8s image
run: |
docker buildx build --push \
--tag agschrei/productivity-images:k8s \
--platform linux/amd64,linux/arm64 k8s
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,10 @@ This is the bare minimum I want to have in an interactive image, is based on ubu
- zsh (set up with [oh-my-zsh](https://github.com/ohmyzsh/ohmyzsh) and the [p10k](https://github.com/romkatv/powerlevel10k) theme)
- build-essential (including gcc and make)

To make installation of additional packages easier, the default user for this image is root.
To make installation of additional packages easier, the default user for this image is root.

## K8s image
This image adds on top of the minimal base image and provides the following:
- kubectl
- helm
A kubeconfig file is expected to be mounted at k8s/config
4 changes: 2 additions & 2 deletions base/.zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ fi
# export PATH=$HOME/bin:/usr/local/bin:$PATH

# Path to your oh-my-zsh installation.
export ZSH="/root/.oh-my-zsh"
export ZSH="/home/debug/.oh-my-zsh"

# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="powerlevel10k/powerlevel10k"

plugins=(git ansible docker python ubuntu)
plugins=(git ansible docker python ubuntu helm kubectl)

source $ZSH/oh-my-zsh.sh

Expand Down
18 changes: 13 additions & 5 deletions base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,21 @@ LABEL org.opencontainers.image.documentation="https://github.com/agschrei/produc
LABEL org.opencontainers.image.source="https://github.com/agschrei/productivity-images.git"
LABEL org.opencontainers.image.licenses="MIT"

RUN apt update && apt upgrade -y && apt install zsh curl git htop build-essential ca-certificates dpkg-dev jq python3 python3-pip fonts-powerline -y --no-install-recommends
RUN apt update && apt upgrade -y && apt install zsh curl git htop build-essential tmux vim ca-certificates dpkg-dev jq python3 python3-pip fonts-powerline -y --no-install-recommends

# change default shell to zsh
RUN chsh -s $(which zsh)
RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
ARG username=debug

# add non-root user and set zsh as default shell
RUN useradd -m ${username} -s $(which zsh)

WORKDIR /home/${username}

USER ${username}:0

# install oh-my-zsh
RUN ZSH=/home/${username}/.oh-my-zsh; sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

RUN git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
COPY *.zsh* ./
COPY --chown=${username}:0 *.zsh* ./

ENTRYPOINT [ "/bin/zsh" ]
22 changes: 22 additions & 0 deletions k8s/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM agschrei/productivity-images:base
# install kubectl and verify the binary
ARG TARGETARCH
ARG HELM_VERSION=3.6.0
# the expected mount location for kubectl config
ENV KUBECONFIG k8s/config
RUN printenv
RUN echo "Installing kubectl binary for ${TARGETARCH}" &&\
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/${TARGETARCH}/kubectl" &&\
curl -LO "https://dl.k8s.io/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/${TARGETARCH}/kubectl.sha256" &&\
echo "$(cat kubectl.sha256) kubectl" | sha256sum --check &&\
rm kubectl.sha256 &&\
chmod +x ./kubectl &&\
mkdir -p ~/.local/bin/ &&\
mv ./kubectl ~/.local/bin/
RUN echo "Installing helm binary for ${TARGETARCH}" && \
curl -LO https://get.helm.sh/helm-v${HELM_VERSION}-linux-${TARGETARCH}.tar.gz &&\
curl -LO https://get.helm.sh/helm-v${HELM_VERSION}-linux-${TARGETARCH}.tar.gz.sha256sum &&\
cat helm-v${HELM_VERSION}-linux-${TARGETARCH}.tar.gz.sha256sum | shasum --check &&\
tar -zxvf helm-v${HELM_VERSION}-linux-${TARGETARCH}.tar.gz &&\
mv linux-${TARGETARCH}/helm ~/.local/bin/ && rm -rf helm-* linux-*
RUN echo "PATH=~/.local/bin/:$PATH" >> .zshrc

0 comments on commit f24a4fa

Please sign in to comment.