From 905b3028b47338f79eb208aa0c4227e72bcdd22b Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Tue, 5 Jul 2016 02:16:37 -0400 Subject: [PATCH] Add an example plugin trigger for cache busting Dockerfile builds Closes #2288 --- docs/development/plugin-triggers.md | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/docs/development/plugin-triggers.md b/docs/development/plugin-triggers.md index 1313bcb03..c70074fe2 100644 --- a/docs/development/plugin-triggers.md +++ b/docs/development/plugin-triggers.md @@ -201,10 +201,23 @@ echo 'derp.dkr.ecr.us-east-1.amazonaws.com' ```shell #!/usr/bin/env bash - +# Sets a docker build-arg called CACHEBUST which can be used +# to bust cache at any arbitrary point in a Dockerfile build set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -# TODO +cache-bust-build-arg() { + declare desc="dockerfile cache busting plugin trigger" + local STDIN=$(cat) + local APP="$1" IMAGE_SOURCE_TYPE="$2" + local output="" + + if [[ "$IMAGE_SOURCE_TYPE" == "dockerfile" ]]; then + output=" --build-arg CACHEBUST=$(date +%s)" + fi + echo -n "$STDIN$output" +} + +cache-bust-build-arg "$@" ``` ### `docker-args-deploy`