Files
dokku/plugins/apps/post-delete
Jose Diaz-Gonzalez 785d9b4937 feat: allow setting DOCKER_BIN path for docker execution
This change allows operators to specify a DOCKER_BIN environment variable. This will specify a binary to run when executing docker, which is useful in cases where the 'docker' command being run must be modified in a way that would otherwise be invasive to Dokku, but minimalistic if done within a wrapper.
2019-05-29 00:46:19 -04:00

23 lines
668 B
Bash
Executable File

#!/usr/bin/env bash
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
app_post_delete() {
declare desc="apps post-delete plugin trigger"
local trigger="app_post_delete"
local APP="$1"
local IMAGE_REPO=$(get_app_image_repo "$APP")
if [[ -n $APP ]]; then
# remove contents for apps that are symlinks to other folders
rm -rf "${DOKKU_ROOT:?}/$APP/" >/dev/null
# then remove the folder and/or the symlink
rm -rf "${DOKKU_ROOT:?}/$APP" >/dev/null
fi
# shellcheck disable=SC2046
"$DOCKER_BIN" rmi $("$DOCKER_BIN" images -q "$IMAGE_REPO" | xargs) &>/dev/null || true
}
app_post_delete "$@"