Files
Agent-System/scripts/build-single-binary.sh
T
weichen b812d1d30f feat(dev): single-binary no-docker runtime with managed localpg
Embed web/dist, run events in-process, manage brew PG18+pgvector, add PI host sidecar and launch --no-docker; unify MiniMax-M2.7-highspeed pins and record dev acceptance.
2026-09-24 15:53:50 +00:00

34 lines
964 B
Bash
Executable File

#!/usr/bin/env bash
# build-single-binary.sh — produce bin/agent-server with embedded web/dist
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$ROOT"
info() { printf '\033[1;34m[build-single-binary]\033[0m %s\n' "$*"; }
SHA="$(git rev-parse --short HEAD)"
OUT="${OUT_BIN:-$ROOT/bin/agent-server}"
info "building web/dist (demo seeds OFF)..."
(
cd "$ROOT/web"
if [[ ! -d node_modules ]]; then
npm ci
fi
env -u VITE_ENABLE_DEMO_SEEDS npm run build
)
if [[ ! -f "$ROOT/web/dist/index.html" ]]; then
echo "missing web/dist/index.html after build" >&2
exit 1
fi
info "go build → $OUT (embed web/dist @ $SHA)..."
mkdir -p "$(dirname "$OUT")"
CGO_ENABLED=0 go build -ldflags="-s -w -X main.version=${SHA}" -o "$OUT" ./cmd/server
info "done: $OUT ($(du -h "$OUT" | awk '{print $1}'))"
info "next: LOCALPG_MODE=managed PI_AGENT_RUNNER_URL=http://127.0.0.1:18865 $OUT"
info " or ./scripts/launch.sh --no-docker"