thread-master/deploy/scripts/build.sh

24 lines
545 B
Bash
Executable File

#!/usr/bin/env bash
# 建置 gateway、worker + web 依賴
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 .
go build -o bin/worker ./cmd/worker
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"