From b6e1926f4563df15e4f98721413d5b713d1b2a46 Mon Sep 17 00:00:00 2001 From: Chris Kim <30601846+Oats87@users.noreply.github.com> Date: Wed, 26 Aug 2020 16:16:09 -0700 Subject: [PATCH] Add a proper cachebust by echoing a build arg set to the current date to /dev/null (#241) Signed-off-by: Chris Kim --- Dockerfile | 12 +++++++----- scripts/build-image-runtime | 1 + 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6c55e3d5ba..c80a63c0b7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -63,12 +63,14 @@ COPY --from=build-k8s \ FROM build AS charts ARG CHARTS_REPO="https://rke2-charts.rancher.io" +ARG CACHEBUST="cachebust" COPY charts/ /charts/ -RUN echo CACHEBUST>/dev/null; CHART_VERSION="v3.13.3" CHART_FILE=/charts/rke2-canal-chart.yml CHART_BOOTSTRAP=true /charts/build-chart.sh -RUN echo CACHEBUST>/dev/null; CHART_VERSION="1.10.101" CHART_FILE=/charts/rke2-coredns-chart.yml CHART_BOOTSTRAP=true /charts/build-chart.sh -RUN echo CACHEBUST>/dev/null; CHART_VERSION="1.36.300" CHART_FILE=/charts/rke2-ingress-nginx-chart.yml CHART_BOOTSTRAP=false /charts/build-chart.sh -RUN echo CACHEBUST>/dev/null; CHART_VERSION="v1.18.4" CHART_FILE=/charts/rke2-kube-proxy-chart.yml CHART_BOOTSTRAP=true /charts/build-chart.sh -RUN echo CACHEBUST>/dev/null; CHART_VERSION="2.11.100" CHART_FILE=/charts/rke2-metrics-server-chart.yml CHART_BOOTSTRAP=false /charts/build-chart.sh +RUN echo ${CACHEBUST}>/dev/null +RUN CHART_VERSION="v3.13.3" CHART_FILE=/charts/rke2-canal-chart.yml CHART_BOOTSTRAP=true /charts/build-chart.sh +RUN CHART_VERSION="1.10.101" CHART_FILE=/charts/rke2-coredns-chart.yml CHART_BOOTSTRAP=true /charts/build-chart.sh +RUN CHART_VERSION="1.36.300" CHART_FILE=/charts/rke2-ingress-nginx-chart.yml CHART_BOOTSTRAP=false /charts/build-chart.sh +RUN CHART_VERSION="v1.18.4" CHART_FILE=/charts/rke2-kube-proxy-chart.yml CHART_BOOTSTRAP=true /charts/build-chart.sh +RUN CHART_VERSION="2.11.100" CHART_FILE=/charts/rke2-metrics-server-chart.yml CHART_BOOTSTRAP=false /charts/build-chart.sh RUN rm -vf /charts/*.sh /charts/*.md # rke-runtime image diff --git a/scripts/build-image-runtime b/scripts/build-image-runtime index 3aa0f0199a..1f04fdc956 100755 --- a/scripts/build-image-runtime +++ b/scripts/build-image-runtime @@ -8,6 +8,7 @@ source ./scripts/version.sh DOCKER_BUILDKIT=${DOCKER_BUILDKIT:-1} docker image build \ --build-arg TAG=${VERSION} \ --build-arg KUBERNETES_VERSION=${KUBERNETES_VERSION} \ + --build-arg CACHEBUST="$(date +%s%N)" \ --tag ${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION} \ --tag ${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION}-${GOARCH} \ --target runtime \