thread-master/deploy/scripts/build.sh

24 lines
545 B
Bash
Raw Permalink Normal View History

2026-07-10 12:54:45 +00:00
#!/usr/bin/env bash
2026-07-14 08:54:31 +00:00
# 建置 gateway、worker + web 依賴
2026-07-10 12:54:45 +00:00
set -euo pipefail
# shellcheck source=_common.sh
source "$(cd "$(dirname "$0")" && pwd)/_common.sh"
require_cmd go
require_cmd npm
log "build backend…"
cd "$BACKEND_DIR"
go build -o bin/gateway .
2026-07-14 08:54:31 +00:00
go build -o bin/worker ./cmd/worker
2026-07-10 12:54:45 +00:00
log "npm install web…"
cd "$WEB_DIR"
if [[ ! -d node_modules ]]; then
npm ci 2>/dev/null || npm install
else
log "node_modules exists — skip full install (npm install 若缺依賴可手動)"
fi
log "build done → $BACKEND_DIR/bin/gateway"