chore(docker): add .env.example and Docker Compose setup/build/run scripts
This commit is contained in:
parent
5701e77780
commit
a1f26bc61f
12 changed files with 943 additions and 7 deletions
65
scripts/down.sh
Executable file
65
scripts/down.sh
Executable file
|
|
@ -0,0 +1,65 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# shellcheck source=scripts/_compose.sh
|
||||
source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)/_compose.sh"
|
||||
|
||||
usage() {
|
||||
cat <<'EOF'
|
||||
Usage: ./scripts/down.sh [options] [-- <extra docker compose down args>]
|
||||
|
||||
Stop and remove GCoordinator Docker Compose containers (preserves ./data and secrets).
|
||||
|
||||
Options:
|
||||
--lan Target LAN compose stack
|
||||
--cloudflare Target Cloudflare compose stack
|
||||
--mode <lan|cloudflare> Explicitly select deployment mode
|
||||
--dry-run Print the compose command without executing it
|
||||
-h, --help Show this help message
|
||||
EOF
|
||||
}
|
||||
|
||||
REQ_MODE=""
|
||||
EXTRA_ARGS=()
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--lan)
|
||||
REQ_MODE="lan"
|
||||
shift
|
||||
;;
|
||||
--cloudflare)
|
||||
REQ_MODE="cloudflare"
|
||||
shift
|
||||
;;
|
||||
--mode)
|
||||
[[ $# -ge 2 ]] || die "--mode requires an argument."
|
||||
REQ_MODE="$2"
|
||||
shift 2
|
||||
;;
|
||||
--mode=*)
|
||||
REQ_MODE="${1#*=}"
|
||||
shift
|
||||
;;
|
||||
--dry-run)
|
||||
DRY_RUN=1
|
||||
shift
|
||||
;;
|
||||
-h|--help)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
EXTRA_ARGS+=("$@")
|
||||
break
|
||||
;;
|
||||
*)
|
||||
die "Unknown option: $1 (pass extra compose flags after '--', or run --help)"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
MODE="$(resolve_mode "$REQ_MODE")"
|
||||
log_info "Stopping GCoordinator stack (mode=$MODE)..."
|
||||
run_compose "$MODE" down --remove-orphans "${EXTRA_ARGS[@]}"
|
||||
Loading…
Add table
Add a link
Reference in a new issue