-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
209 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,209 @@ | ||
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" \ | ||
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 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.0.9" \ | ||
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 \ | ||
gettext \ | ||
git \ | ||
iproute2 \ | ||
iputils-ping \ | ||
iputils-tracepath \ | ||
jq \ | ||
libffi-dev \ | ||
libssl-dev \ | ||
net-tools \ | ||
nmap \ | ||
pv \ | ||
python3.12 \ | ||
python3.12-venv \ | ||
python3-full \ | ||
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 && \ | ||
pip3 install giturlparse.py 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://storage.googleapis.com/kubernetes-release/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 | ||
|
||
COPY root/ / | ||
COPY root/etc/skel/ /root/ | ||
COPY Dockerfile / | ||
|
||
ARG GIT_COMMIT | ||
ARG VERSION | ||
ARG RELEASE | ||
|
||
RUN echo $VERSION > /.version && \ | ||
echo $RELEASE > /.release && \ | ||
echo $GIT_COMMIT > /.gitcommit && \ | ||
rsync /etc/skel/ /root/ && \ | ||
chmod -R +x /etc/profile.d/ && \ | ||
chmod 777 /usr/share | ||
|
||
ENTRYPOINT ["/usr/local/bin/entrypoint"] |