Skip to content

Commit

Permalink
demos/WordPress: Delete _TEMP directory as part of cleanup ...
Browse files Browse the repository at this point in the history
... in demos/WordPress/build_start_stop_destroy_loop.sh
  • Loading branch information
SergeyKleyman committed Nov 17, 2022
1 parent bb6ce82 commit c34846a
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions demos/WordPress/build_start_stop_destroy_loop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ function wait_for_approval_and_run_command() {

function cleanup () {
wait_for_approval_and_run_command "${docker_cmd_prefix} down -v --remove-orphans"

local this_script_dir
this_script_dir="$( dirname "${BASH_SOURCE[0]}" )"
this_script_dir="$( realpath "${this_script_dir}" )"
wait_for_approval_and_run_command "rm -rf \"${this_script_dir}/_TEMP/\""
}

function main() {
Expand All @@ -55,18 +60,15 @@ function main() {
docker_cmd_prefix="${docker_cmd_prefix} ${DOCKER_COMPOSE_OPTIONS}"
fi

if [ -n "${Z_LOCAL_ACTION}" ]; then
run_command "${docker_cmd_prefix} ${Z_LOCAL_ACTION}"
else
trap cleanup EXIT
while :
do
wait_for_approval_and_run_command "${docker_cmd_prefix} build"
wait_for_approval_and_run_command "${docker_cmd_prefix} up"
wait_for_approval_and_run_command "${docker_cmd_prefix} stop"
wait_for_approval_and_run_command "${docker_cmd_prefix} down -v --remove-orphans"
done
fi
trap cleanup EXIT

while :
do
wait_for_approval_and_run_command "${docker_cmd_prefix} build"
wait_for_approval_and_run_command "${docker_cmd_prefix} up"
wait_for_approval_and_run_command "${docker_cmd_prefix} stop"
cleanup
done
}

main

0 comments on commit c34846a

Please sign in to comment.