diff --git a/plugins/apps/pre-delete b/plugins/apps/pre-delete index 92a2ae159..24f924071 100755 --- a/plugins/apps/pre-delete +++ b/plugins/apps/pre-delete @@ -8,17 +8,13 @@ apps_pre_delete() { local trigger="apps_pre_delete" local APP="$1" local IMAGE_TAG="$2" - local IMAGE=$(get_deploying_app_image_name "$APP" "$IMAGE_TAG") local CACHE_DIR="$DOKKU_ROOT/$APP/cache" local CACHE_HOST_DIR="$DOKKU_HOST_ROOT/$APP/cache" verify_app_name "$APP" - if ! is_image_herokuish_based "$IMAGE"; then - return - fi - if [[ -d $CACHE_DIR ]]; then - "$DOCKER_BIN" run "$DOKKU_GLOBAL_RUN_ARGS" --rm -v "$CACHE_HOST_DIR:/cache" "$IMAGE" find /cache -depth -mindepth 1 -maxdepth 1 -exec rm -Rf {} \; || true + DOKKU_IMAGE="$(config_get "$APP" DOKKU_IMAGE || echo "$DOKKU_IMAGE")" + "$DOCKER_BIN" run "$DOKKU_GLOBAL_RUN_ARGS" --rm -v "$CACHE_HOST_DIR:/cache" "$DOKKU_IMAGE" find /cache -depth -mindepth 1 -maxdepth 1 -exec rm -Rf {} \; || true fi } diff --git a/plugins/repo/src/subcommands/purge-cache/purge-cache.go b/plugins/repo/src/subcommands/purge-cache/purge-cache.go index a1cf19728..2b5732b7e 100644 --- a/plugins/repo/src/subcommands/purge-cache/purge-cache.go +++ b/plugins/repo/src/subcommands/purge-cache/purge-cache.go @@ -6,6 +6,7 @@ import ( "strings" "github.com/dokku/dokku/plugins/common" + "github.com/dokku/dokku/plugins/config" ) // deletes the contents of the build cache stored in the repository @@ -23,7 +24,7 @@ func main() { cacheDir := strings.Join([]string{common.MustGetEnv("DOKKU_ROOT"), appName, "cache"}, "/") cacheHostDir := strings.Join([]string{common.MustGetEnv("DOKKU_HOST_ROOT"), appName, "cache"}, "/") dokkuGlobalRunArgs := common.MustGetEnv("DOKKU_GLOBAL_RUN_ARGS") - image := common.GetDeployingAppImageName(appName, "", "") + image := config.GetWithDefault(appName, "DOKKU_IMAGE", os.Getenv("DOKKU_IMAGE")) if info, _ := os.Stat(cacheDir); info != nil && info.IsDir() { purgeCacheCmd := common.NewShellCmd(strings.Join([]string{ common.DockerBin(),