1 file changed
+18
-4
@@ -4,6 +4,12 @@ set -eo pipefail
|
|||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||||
|
|
||||||
|
fn-stop-container() {
|
||||||
|
declare APP="$1" CID="$2"
|
||||||
|
"$DOCKER_BIN" container update --restart=no "$CID" &>/dev/null || true
|
||||||
|
"$DOCKER_BIN" container stop $DOCKER_STOP_TIME_ARG "$CID" &>/dev/null || true
|
||||||
|
}
|
||||||
|
|
||||||
trigger-scheduler-docker-local-scheduler-stop() {
|
trigger-scheduler-docker-local-scheduler-stop() {
|
||||||
declare desc="scheduler-docker-local scheduler-stop plugin trigger"
|
declare desc="scheduler-docker-local scheduler-stop plugin trigger"
|
||||||
declare trigger="scheduler-stop"
|
declare trigger="scheduler-stop"
|
||||||
@@ -19,14 +25,22 @@ trigger-scheduler-docker-local-scheduler-stop() {
|
|||||||
[[ -n "$DOKKU_DOCKER_STOP_TIMEOUT" ]] && DOCKER_STOP_TIME_ARG="--time=${DOKKU_DOCKER_STOP_TIMEOUT}"
|
[[ -n "$DOKKU_DOCKER_STOP_TIMEOUT" ]] && DOCKER_STOP_TIME_ARG="--time=${DOKKU_DOCKER_STOP_TIMEOUT}"
|
||||||
|
|
||||||
if [[ -n "$DOKKU_APP_RUNNING_CONTAINER_IDS" ]]; then
|
if [[ -n "$DOKKU_APP_RUNNING_CONTAINER_IDS" ]]; then
|
||||||
# Disable the container restart policy
|
for CID in $DOKKU_APP_RUNNING_CONTAINER_IDS; do
|
||||||
"$DOCKER_BIN" container update --restart=no $DOKKU_APP_RUNNING_CONTAINER_IDS &>/dev/null || true
|
fn-stop-container "$APP" "$CID"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
"$DOCKER_BIN" container stop $DOCKER_STOP_TIME_ARG $DOKKU_APP_RUNNING_CONTAINER_IDS >/dev/null || true
|
# Stop all other containers related to the app
|
||||||
|
# fetch all containers with the com.dokku.app-name label
|
||||||
|
local DOKKU_APP_CIDS="$(docker container ls -q -f label=com.dokku.app-name="$APP")"
|
||||||
|
if [[ -n "$DOKKU_APP_CIDS" ]]; then
|
||||||
|
for CID in $DOKKU_APP_CIDS; do
|
||||||
|
fn-stop-container "$APP" "$CID"
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$REMOVE_CONTAINERS" == "true" ]]; then
|
if [[ "$REMOVE_CONTAINERS" == "true" ]]; then
|
||||||
local DOKKU_APP_CIDS=$(get_app_container_ids "$APP")
|
local DOKKU_APP_CIDS="$(docker ps -q -f label=com.dokku.app-name="$APP")"
|
||||||
|
|
||||||
if [[ -n "$DOKKU_APP_CIDS" ]]; then
|
if [[ -n "$DOKKU_APP_CIDS" ]]; then
|
||||||
for CID in $DOKKU_APP_CIDS; do
|
for CID in $DOKKU_APP_CIDS; do
|
||||||
|
|||||||
Reference in new issue
Block a user