♻️ Move version numbers to their individual build stage for better caching

This commit is contained in:
Jérôme Petazzoni
2021-11-13 12:51:39 +01:00
parent 481b914d50
commit 34c2cdb62c
+30 -12
View File
@@ -3,26 +3,19 @@ RUN apk add curl git
ARG BUILDARCH TARGETARCH
ENV BUILDARCH=$BUILDARCH \
CGO_ENABLED=0 \
COMPOSE_VERSION=2.1.1 \
GOARCH=$TARGETARCH \
HELM_VERSION=3.7.1 \
JID_VERSION=0.7.6 \
KUBECTL_VERSION=1.22.2 \
KUBELINTER_VERSION=0.2.5 \
KUBESEAL_VERSION=0.16.0 \
KUSTOMIZE_VERSION=4.4.1 \
REGCLIENT_VERSION=0.3.9 \
SHIP_VERSION=0.51.3 \
STERN_VERSION=1.20.1 \
TARGETARCH=$TARGETARCH \
TILT_VERSION=0.23.0
TARGETARCH=$TARGETARCH
COPY helper-* /bin
# https://github.com/docker/compose/releases
FROM builder AS compose
ENV COMPOSE_VERSION=2.1.1
RUN helper-curl bin docker-compose \
https://github.com/docker/compose/releases/download/v${COMPOSE_VERSION}/docker-compose-linux-@UARCH
# https://github.com/helm/helm/releases
FROM builder AS helm
ENV HELM_VERSION=3.7.1
RUN helper-curl tar "--strip-components=1 linux-@GOARCH/helm" \
https://get.helm.sh/helm-v${HELM_VERSION}-linux-@GOARCH.tar.gz
@@ -33,55 +26,80 @@ WORKDIR httping
RUN sed -i s/60/0/ utils.c
RUN make install BINDIR=/usr/local/bin
# https://github.com/simeji/jid/releases
FROM builder AS jid
ENV JID_VERSION=0.7.6
RUN go install github.com/simeji/jid/cmd/jid@v$JID_VERSION
RUN cp $(find bin -name jid) /usr/local/bin
# https://github.com/derailed/k9s/releases
FROM builder AS k9s
RUN helper-curl tar k9s \
https://github.com/derailed/k9s/releases/latest/download/k9s_Linux_@WTFARCH.tar.gz
# https://github.com/kubernetes/kompose/releases
FROM builder AS kompose
RUN helper-curl bin kompose \
https://github.com/kubernetes/kompose/releases/latest/download/kompose-linux-@GOARCH
# https://github.com/kubernetes/kubernetes/releases
FROM builder AS kubectl
ENV KUBECTL_VERSION=1.22.3
RUN helper-curl bin kubectl \
https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VERSION}/bin/linux/@GOARCH/kubectl
# https://github.com/stackrox/kube-linter/releases
FROM builder AS kube-linter
ENV KUBELINTER_VERSION=0.2.5
RUN go install golang.stackrox.io/kube-linter/cmd/kube-linter@$KUBELINTER_VERSION
RUN cp $(find bin -name kube-linter) /usr/local/bin
# https://github.com/bitnami-labs/sealed-secrets/releases
FROM builder AS kubeseal
ENV KUBESEAL_VERSION=0.16.0
RUN helper-curl bin kubeseal \
https://github.com/bitnami-labs/sealed-secrets/releases/download/v$KUBESEAL_VERSION/kubeseal-@KSARCH
# https://github.com/kubernetes-sigs/kustomize/releases
FROM builder AS kustomize
ENV KUSTOMIZE_VERSION=4.4.1
RUN helper-curl tar kustomize \
https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/v$KUSTOMIZE_VERSION/kustomize_v${KUSTOMIZE_VERSION}_linux_@GOARCH.tar.gz
# https://github.com/derailed/popeye/releases
FROM builder AS popeye
RUN helper-curl tar popeye \
https://github.com/derailed/popeye/releases/latest/download/popeye_Linux_@WTFARCH.tar.gz
# https://github.com/regclient/regclient/releases
FROM builder AS regctl
ENV REGCLIENT_VERSION=0.3.9
RUN helper-curl bin regctl \
https://github.com/regclient/regclient/releases/download/v$REGCLIENT_VERSION/regctl-linux-@GOARCH
# This tool is still used in the kustomize section, but we will probably
# deprecate it eventually as we only use a tiny feature that doesn't seem
# to be available anymore in more recent versions (or requires some work
# to adapt). Also, it's not available on all platforms and doesn't compile.
FROM builder AS ship
ENV SHIP_VERSION=0.51.3
RUN helper-curl tar ship \
https://github.com/replicatedhq/ship/releases/download/v${SHIP_VERSION}/ship_${SHIP_VERSION}_linux_@GOARCH.tar.gz
# https://github.com/GoogleContainerTools/skaffold/releases/tag/v1.34.0
FROM builder AS skaffold
RUN helper-curl bin skaffold \
https://storage.googleapis.com/skaffold/releases/latest/skaffold-linux-@GOARCH
# https://github.com/stern/stern/releases
FROM builder AS stern
ENV STERN_VERSION=1.20.1
RUN helper-curl tar "--strip-components=1 stern_${STERN_VERSION}_linux_@GOARCH/stern" \
https://github.com/stern/stern/releases/download/v${STERN_VERSION}/stern_${STERN_VERSION}_linux_@GOARCH.tar.gz
# https://github.com/tilt-dev/tilt/releases/
FROM builder AS tilt
ENV TILT_VERSION=0.23.0
RUN helper-curl tar tilt \
https://github.com/tilt-dev/tilt/releases/download/v${TILT_VERSION}/tilt.${TILT_VERSION}.linux.@WTFARCH.tar.gz