-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy pathdev.sh
More file actions
executable file
·117 lines (110 loc) · 3.15 KB
/
Copy pathdev.sh
File metadata and controls
executable file
·117 lines (110 loc) · 3.15 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#!/usr/bin/env bash
set -euo pipefail
COMPOSE_FILE="build/dev/docker-compose.yml"
BAKE_FILE="build/dev/docker-bake.hcl"
_compose() { docker compose --project-directory . --file "$COMPOSE_FILE" "$@"; }
_bake() { docker buildx bake --file "$BAKE_FILE" "$@"; }
_ensure_tooling() {
docker image inspect docs-builder:tooling >/dev/null 2>&1 \
|| _bake --load tooling
}
_ensure_runtime() {
docker image inspect docs-builder:local >/dev/null 2>&1 \
|| _bake --load runtime
}
_ensure_mcp() {
docker image inspect docs-builder:mcp >/dev/null 2>&1 \
|| _bake --load mcp
}
_ensure_api() {
docker image inspect docs-builder:api >/dev/null 2>&1 \
|| _bake --load api
}
case "${1:-help}" in
help|--help|-h)
echo "Usage: ./dev.sh <command>"
echo ""
echo " build Build the dev Docker images"
echo " build-api Build only the docs API Docker image"
echo " build-mcp Build only the MCP server Docker image"
echo " rebuild Rebuild the dev Docker images without cache"
echo " serve Serve docs at http://localhost:3000 with hot reload"
echo " serve-detached Serve docs in the background"
echo " stop Stop the development server"
echo " docs Build the current documentation set"
echo " test Run the unit-test suite (delegates to ./build.sh unit-test)"
echo " serve-api Run the docs API at http://localhost:8081"
echo " serve-api-detached Run the docs API in the background"
echo " stop-api Stop the docs API"
echo " serve-mcp Run the MCP server at http://localhost:8080 (public profile)"
echo " serve-mcp-internal Run the MCP server at http://localhost:8080 (internal profile)"
echo " serve-mcp-detached Run the MCP server in the background"
echo " stop-mcp Stop the MCP server"
echo " clean Stop containers and remove containers, networks, and volumes"
;;
build)
_bake --load all
;;
build-api)
_bake --load api "${@:2}"
;;
build-mcp)
_bake --load mcp "${@:2}"
;;
rebuild)
_bake --no-cache --load all
;;
serve)
_ensure_tooling
_compose up --no-build serve
;;
serve-detached)
_ensure_tooling
_compose up --no-build -d serve
;;
stop)
_compose stop serve
;;
docs)
_ensure_runtime
_compose run --rm docs-builder build
;;
test)
_ensure_tooling
_compose run --rm tests
;;
serve-api)
_ensure_api
_compose up --no-build api
;;
serve-api-detached)
_ensure_api
_compose up --no-build -d api
;;
stop-api)
_compose stop api
;;
serve-mcp)
_ensure_mcp
_compose up --no-build mcp
;;
serve-mcp-internal)
_ensure_mcp
MCP_SERVER_PROFILE=internal _compose up --no-build mcp
;;
serve-mcp-detached)
_ensure_mcp
_compose up --no-build -d mcp
;;
stop-mcp)
_compose stop mcp
;;
clean)
_compose down --remove-orphans --volumes
;;
*)
echo "error: unknown command '$1'" >&2
echo "Run './dev.sh help' for usage." >&2
exit 1
;;
esac