refactor: drop all application-related docker code from apps plugin

This commit is contained in:
Jose Diaz-Gonzalez
2018-02-07 21:52:17 -07:00
parent 46f912659f
commit 3f1de1fd10
6 changed files with 49 additions and 20 deletions

View File

@@ -32,21 +32,11 @@ apps_destroy() {
fi
echo "Destroying $APP (including all add-ons)"
plugn trigger pre-delete "$APP" "$IMAGE_TAG"
local DOKKU_APP_CIDS=$(get_app_container_ids "$APP")
local DOKKU_DOCKER_STOP_TIMEOUT="$(config_get "$APP" DOKKU_DOCKER_STOP_TIMEOUT || true)"
[[ $DOKKU_DOCKER_STOP_TIMEOUT ]] && DOCKER_STOP_TIME_ARG="--time=${DOKKU_DOCKER_STOP_TIMEOUT}"
if [[ -n $DOKKU_APP_CIDS ]]; then
local cid
for cid in $DOKKU_APP_CIDS; do
# shellcheck disable=SC2086
docker stop $DOCKER_STOP_TIME_ARG "$cid" > /dev/null || true
docker rm "$cid" > /dev/null || true
done
fi
local DOKKU_SCHEDULER=$(config_get "$APP" DOKKU_SCHEDULER || echo "docker-local")
local REMOVE_CONTAINERS="true"
plugn trigger scheduler-stop "$DOKKU_SCHEDULER" "$APP" "$REMOVE_CONTAINERS"
plugn trigger post-delete "$APP" "$IMAGE_TAG"
}

View File

@@ -13,9 +13,6 @@ app_post_delete() {
rm -rf "${DOKKU_ROOT:?}/$APP" > /dev/null
fi
# remove all application containers & images
# shellcheck disable=SC2046
docker rm -f $(docker ps -a --no-trunc | egrep "dokku/${APP}:" | awk '{ print $1 }' | xargs) &>/dev/null || true
# shellcheck disable=SC2046
docker rmi $(docker images -q "$IMAGE_REPO" | xargs) &>/dev/null || true
}