Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update alpine image | added debian image #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
.vscode
.vscode
.env
.DS_Store
13 changes: 6 additions & 7 deletions dist/alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@ FROM python:3.8-alpine3.12 as k8s_build
ARG KOPS_VERSION
ARG HELM_VERSION
RUN \
mkdir /main && \
set -x; > /etc/inittab && mkdir /main && \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set -x can be useful to display the actual command that is running. A bit unclear on what is the purpose for removing /etc/inittab though. 🤔

apk update && \
# export functions, for download, json parsing, ssh keygen, api keygen
apk add --no-cache bash curl jq openssh openssl && \
apk add --no-cache bash curl jq openssh openssl util-linux bind-tools && \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see bind-tools useful for using dig in debugging DNS. What's specifically useful for debugging from util-linux?

# for aws cli, yaml parsing
pip install awscli --upgrade --user --no-cache-dir && \
# YQ (last verified was 3.4.0)
curl -L $(echo "https://github.com/mikefarah/yq/releases/download/\
$(curl https://api.github.com/repos/mikefarah/yq/releases/latest | jq -r '.tag_name')/\
yq_linux_amd64" | tr -d '\n' | tr -d '\t') -o /usr/local/bin/yq && \
# YQ (v4 needs migration)
curl -L "https://github.com/mikefarah/yq/releases/download/3.4.1/yq_linux_amd64" \
-o /usr/local/bin/yq && \
chmod +x /usr/local/bin/yq && \
# KOPS
curl -L $(echo "https://github.com/kubernetes/kops/releases/download/${KOPS_VERSION}\
Expand Down Expand Up @@ -54,4 +53,4 @@ ENV PATH "/root/.local/bin:$PATH"
WORKDIR /main
VOLUME /main
SHELL ["/bin/bash", "-lc"]
CMD ["/bin/bash"]
CMD ["/bin/bash"]
12 changes: 5 additions & 7 deletions dist/alpine/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
version: '2.4'
services:
app:
build: # Uncomment to enable local build
build:
# Uncomment to enable local build
context: ../..
dockerfile: ./dist/alpine/Dockerfile
args:
- KOPS_VERSION
- HELM_VERSION
image: vathes/k8s-admin:kops${KOPS_VERSION}-helm${HELM_VERSION}-alpine
command:
image: registry.vathes.com/vathes/k8s-admin:kops${KOPS_VERSION}-helm${HELM_VERSION}-alpine
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this image is public we published it to Docker Hub. We technically could get away with free storage on this one. 😅

command:
- bash
- -c
- >
echo "$$0 running...";
echo "PATH: '$$PATH'";
tail -f /dev/null;

echo "$$0 running..."; echo "PATH: '$$PATH'"; tail -f /dev/null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
echo "$$0 running..."; echo "PATH: '$$PATH'"; tail -f /dev/null;
- |
echo "$$0 running..."
echo "PATH: '$$PATH'"
tail -f /dev/null

56 changes: 56 additions & 0 deletions dist/debian/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
FROM python:3.8-bullseye as k8s_build
ARG KOPS_VERSION
ARG HELM_VERSION
RUN \
set -x; > /etc/inittab && mkdir /main && \
apt update && \
# export functions, for download, json parsing, ssh keygen, api keygen
apt add --no-cache bash curl jq openssh openssl util-linux bind-tools && \
# for aws cli, yaml parsing
pip install awscli --upgrade --user --no-cache-dir && \
# YQ (v4 needs migration)
curl -L "https://github.com/mikefarah/yq/releases/download/3.4.1/yq_linux_amd64" \
-o /usr/local/bin/yq && \
chmod +x /usr/local/bin/yq && \
# KOPS
curl -L $(echo "https://github.com/kubernetes/kops/releases/download/${KOPS_VERSION}\
/kops-linux-amd64" | tr -d '\n' | tr -d '\t') -o /usr/local/bin/kops && \
chmod +x /usr/local/bin/kops && \
# KUBECTL
mkdir ${HOME}/.kube && \
curl -L $(echo "https://storage.googleapis.com/kubernetes-release/release/\
$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)\
/bin/linux/amd64/kubectl" | tr -d '\n' | tr -d '\t') -o /usr/local/bin/kubectl && \
chmod +x /usr/local/bin/kubectl && \
# HELM
curl -L https://get.helm.sh/helm-${HELM_VERSION}-linux-amd64.tar.gz \
-o /tmp/helm.tar.gz && \
tar -zxvf /tmp/helm.tar.gz --strip-components=1 -C /usr/local/bin/ linux-amd64/helm && \
rm /tmp/helm.tar.gz && \
chmod +x /usr/local/bin/helm && \
[ ! "${HELM_VERSION}" == "v2.14.1" ] || helm init --history-max 200 --client-only && \
[ ! "${HELM_VERSION}" == "v3.3.0" ] || helm repo add stable \
https://kubernetes-charts.storage.googleapis.com/ && \
## ------- OPTIONAL -------
# AWS IAM AUTHENTICATOR CLIENT
curl -L $(echo "https://github.com/kubernetes-sigs/aws-iam-authenticator/releases\
/download/v0.5.1/aws-iam-authenticator_0.5.1_linux_amd64" | tr -d '\n' | tr -d '\t') \
-o /usr/local/bin/aws-iam-authenticator && \
chmod +x /usr/local/bin/aws-iam-authenticator && \
# BASH Shell Prompt
echo "export PATH=/root/.local/bin:${PATH}" > /etc/profile.d/env.sh && \
echo $(echo 'export PS1="\[\e[32;1m\]\u\[\e[m\]@\[\e[34;1m\]\H\[\e[m\]:\
\[\e[33;1m\]\w\[\e[m\]$ "' | tr -d '\n' | tr -d '\t') > /root/.bashrc
ENV PATH "/root/.local/bin:$PATH"

# #Squashed Final Image
FROM scratch
COPY --from=k8s_build / /
LABEL maintainerName="Raphael Guzman" \
maintainerEmail="[email protected]" \
maintainerCompany="DataJoint"
ENV PATH "/root/.local/bin:$PATH"
WORKDIR /main
VOLUME /main
SHELL ["/bin/bash", "-lc"]
CMD ["/bin/bash"]
16 changes: 16 additions & 0 deletions dist/debian/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: '2.4'
services:
app:
build:
# Uncomment to enable local build
context: ../..
dockerfile: ./dist/alpine/Dockerfile
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
dockerfile: ./dist/alpine/Dockerfile
dockerfile: ./dist/debian/Dockerfile

args:
- KOPS_VERSION
- HELM_VERSION
image: registry.vathes.com/vathes/k8s-admin:kops${KOPS_VERSION}-helm${HELM_VERSION}-debian
command:
- bash
- -c
- >
echo "$$0 running..."; echo "PATH: '$$PATH'"; tail -f /dev/null;
Comment on lines +11 to +16
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
image: registry.vathes.com/vathes/k8s-admin:kops${KOPS_VERSION}-helm${HELM_VERSION}-debian
command:
- bash
- -c
- >
echo "$$0 running..."; echo "PATH: '$$PATH'"; tail -f /dev/null;
image: vathes/k8s-admin:kops${KOPS_VERSION}-helm${HELM_VERSION}-debian
command:
- bash
- -c
- |
echo "$$0 running..."
echo "PATH: '$$PATH'"
tail -f /dev/null