-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdev.sh
More file actions
executable file
·64 lines (57 loc) · 1.66 KB
/
Copy pathdev.sh
File metadata and controls
executable file
·64 lines (57 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env bash
set -euo pipefail
# ------------------------------------------------------------------
# Simple dev launcher for ClimateClaw
#
# Custom flags (handled here, NOT passed to docker compose):
# --debug / --DEBUG -> DEBUG=1
# --debug=0 / --DEBUG=0 -> DEBUG=0
# --no-debug -> DEBUG=0
#
# Everything else is passed through to `docker compose`.
#
# Examples:
# ./dev.sh up
# ./dev.sh up --build -d
# ./dev.sh --debug up --build -d
# ./dev.sh up --build -d --debug
#
# IMPORTANT: A debug launcher (launch.json in VSCode) should be
# configured to be able to use DEBUG mode.
# ------------------------------------------------------------------
# Set CLIMATECLAW_DEV flag for everything in this session
export CLIMATECLAW_DEV=1
CLIMATECLAW_DEBUG="${CLIMATECLAW_DEBUG:-0}"
COMPOSE_FILE="docker-compose.dev.yml"
COMPOSE_ARGS=()
for arg in "$@"; do
case "$arg" in
# Enable debug
--debug|--DEBUG)
CLIMATECLAW_DEBUG=1
;;
# Explicit value: --debug=0 / --DEBUG=1 etc.
--debug=*|--DEBUG=*)
CLIMATECLAW_DEBUG="${arg#*=}"
;;
# Disable debug
--no-debug)
CLIMATECLAW_DEBUG=0
;;
# Help
-h|--help)
print_usage
exit 0
;;
# Everything else goes to docker compose
*)
COMPOSE_ARGS+=("$arg")
;;
esac
done
# Export for docker compose / containers
export CLIMATECLAW_DEBUG
echo "[dev.sh] Using ${COMPOSE_FILE} with DEBUG=${CLIMATECLAW_DEBUG}"
echo "[dev.sh] docker compose -f ${COMPOSE_FILE} ${COMPOSE_ARGS[*]}"
docker compose -f "${COMPOSE_FILE}" --profile build-only build climateclaw-base
docker compose -f "${COMPOSE_FILE}" "${COMPOSE_ARGS[@]}"