FROM scratch AS helm-remote ARG HELM_VERSION=3.16.4 ADD https://get.helm.sh/helm-v${HELM_VERSION}-linux-amd64.tar.gz /srv/helm-linux-amd64.tar.gz FROM scratch AS helm-diff-remote ARG HELM_DIFF_VERSION=3.5.0 ADD https://github.com/databus23/helm-diff/releases/download/v${HELM_DIFF_VERSION}/helm-diff-linux-amd64.tgz /srv/helm-diff-linux-amd64.tgz FROM scratch AS helm-git-remote ARG HELM_GIT_VERSION=1.3.0 ADD https://github.com/aslafy-z/helm-git/archive/refs/tags/v${HELM_GIT_VERSION}.tar.gz /srv/helm-git.tar.gz FROM scratch AS helmfile-remote ARG HELMFILE_VERSION=0.149.0 ADD https://github.com/helmfile/helmfile/releases/download/v${HELMFILE_VERSION}/helmfile_${HELMFILE_VERSION}_linux_amd64.tar.gz /srv/helmfile_linux_amd64.tar.gz FROM scratch AS kubectl-remote ARG KUBECTL_VERSION=1.24.1 ADD https://dl.k8s.io/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl /srv/kubectl FROM scratch AS kustomize-remote ARG KUSTOMIZE_VERSION=3.8.10 #ARG KUSTOMIZE_VERSION=5.5.0 ADD https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv${KUSTOMIZE_VERSION}/kustomize_v${KUSTOMIZE_VERSION}_linux_amd64.tar.gz /srv/kustomize_linux_amd64.tar.gz FROM scratch AS istioctl-remote ARG ISTIOCTL_VERSION=1.15.0 ADD https://github.com/istio/istio/releases/download/${ISTIOCTL_VERSION}/istio-${ISTIOCTL_VERSION}-linux-amd64.tar.gz /srv/istioctl-linux-amd64.tar.gz FROM scratch AS skopeo-remote ARG SKOPEO_VERSION=1.15.0 ADD https://github.com/containers/skopeo/archive/refs/tags/v${SKOPEO_VERSION}.tar.gz /srv/skopeo.tar.gz FROM debian:bookworm-20241223-slim AS host-base-tools RUN true && \ apt-get update && \ apt-get install -y bash-completion git libgpgme11 libsubid4 libdevmapper1.02.1 && \ adduser tool && \ getent passwd && \ apt-get clean && \ true FROM host-base-tools AS skopeo-compiled COPY --from=skopeo-remote /srv/skopeo.tar.gz /srv/skopeo.tar.gz RUN true && set -x && \ echo "deb http://deb.debian.org/debian/ bookworm-backports main" > /etc/apt/sources.list.d/bookworm-backups.list && \ apt-get update && \ apt-get install -y \ make libgpgme-dev libassuan-dev libbtrfs-dev libdevmapper-dev pkg-config \ golang-1.22-go golang-1.22 go-md2man \ && \ apt-get clean && \ mkdir /srv/build && cd /srv/build && tar xzvf /srv/skopeo.tar.gz && \ mv skopeo-* /srv/skopeo && \ cd /srv/skopeo && \ PATH=/usr/lib/go-1.22/bin:$PATH make && \ cp bin/skopeo /usr/local/bin/skopeo && \ cd /srv && \ rm /srv/skopeo* -rf && \ apt-get remove -y \ make libgpgme-dev libassuan-dev libbtrfs-dev libdevmapper-dev pkg-config \ golang-1.22-go golang-1.22 go-md2man \ && \ true FROM host-base-tools AS host-build-tools COPY --from=helm-remote /srv/helm-linux-amd64.tar.gz /srv/helm-linux-amd64.tar.gz COPY --from=helm-diff-remote /srv/helm-diff-linux-amd64.tgz /srv/helm-diff-linux-amd64.tgz COPY --from=helm-git-remote /srv/helm-git.tar.gz /srv/helm-git.tar.gz COPY --from=helmfile-remote /srv/helmfile_linux_amd64.tar.gz /srv/helmfile_linux_amd64.tar.gz COPY --from=kubectl-remote /srv/kubectl /usr/local/bin/kubectl COPY --from=kustomize-remote /srv/kustomize_linux_amd64.tar.gz /srv/kustomize_linux_amd64.tar.gz COPY --from=istioctl-remote /srv/istioctl-linux-amd64.tar.gz /srv/istioctl-linux-amd64.tar.gz # requires: libgpgme11 libsubid4 libdevmapper1.02.1 COPY --from=skopeo-compiled /usr/local/bin/skopeo /usr/local/bin/skopeo RUN true && set -x && \ chown tool:tool /srv/* && \ chmod +x /usr/local/bin/kubectl && \ cd /tmp && \ mkdir install && cd install && \ tar -zxvf /srv/helm-linux-amd64.tar.gz && \ mv linux-amd64/helm /usr/local/bin/helm && \ cd .. && rm -rf install && \ mkdir install && cd install && \ tar -zxvf /srv/helmfile_linux_amd64.tar.gz && \ mv helmfile /usr/local/bin/helmfile && \ cd .. && rm -rf install && \ mkdir install && cd install && \ tar -zxvf /srv/istioctl-linux-amd64.tar.gz && \ ls istio-*/bin/ && \ mv istio-*/bin/istioctl /usr/local/bin/istioctl && \ cd .. && rm -rf install && \ tar -zxvf /srv/kustomize_linux_amd64.tar.gz && \ mv kustomize /usr/local/bin/kustomize && \ cd .. && rm -rf install && \ helm completion bash > /etc/bash_completion.d/helm && \ istioctl completion bash > /etc/bash_completion.d/istioctl && \ kubectl completion bash > /etc/bash_completion.d/kubectl && \ kustomize completion bash > /etc/bash_completion.d/kustomize && \ skopeo completion bash > /etc/bash_completion.d/skopeo && \ true USER tool:tool RUN true && set -x && \ cd /home/tool && \ helm env > /tmp/.helm-env && . /tmp/.helm-env && rm /tmp/.helm-env && \ mkdir -p $HELM_PLUGINS && \ tar -C $HELM_PLUGINS -xf /srv/helm-diff-linux-amd64.tgz && \ tar -C $HELM_PLUGINS -xf /srv/helm-git.tar.gz && \ kustomize version && \ helm version && helm plugin list && \ helmfile version && \ istioctl version --remote=false && \ skopeo -v && \ mkdir -p .config/kustomize/plugin && \ mkdir .ssh && chmod 700 .ssh && \ true FROM host-base-tools AS final-output COPY --from=host-build-tools /home/tool/ /home/tool/ COPY --from=host-build-tools /usr/local/bin/ /usr/local/bin/ COPY --from=host-build-tools /usr/local/sbin/ /usr/local/sbin/ COPY --from=host-build-tools /etc/bash_completion.d/ /etc/bash_completion.d/ COPY entrypoint.sh /usr/local/sbin/entrypoint.sh ENTRYPOINT ["entrypoint.sh"]