diff --git a/.gitignore b/.gitignore index 945ae0f..8afbf29 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ coverage/ test-results/ playwright-report/ apps/desktop/release/ +.builds/ diff --git a/scripts/build-web-linux.sh b/scripts/build-web-linux.sh new file mode 100755 index 0000000..43f4565 --- /dev/null +++ b/scripts/build-web-linux.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +set -euo pipefail + +ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +BUILD_DIR="$ROOT_DIR/.builds/linux" +BACKEND_DIR="$BUILD_DIR/backend" +WEB_DIR="$BUILD_DIR/web_v1" + +# Override GOARCH when building for another Linux architecture, for example arm64. +GOARCH="${GOARCH:-amd64}" + +rm -rf "$BACKEND_DIR" "$WEB_DIR" +mkdir -p "$BACKEND_DIR" "$WEB_DIR" + +( + cd "$ROOT_DIR/backend" + go test ./... + CGO_ENABLED=0 GOOS=linux GOARCH="$GOARCH" go build -trimpath -o "$BACKEND_DIR/senlin-agent-api" ./cmd/api +) + +( + cd "$ROOT_DIR/apps/web_v1" + npm run build + cp -R dist/. "$WEB_DIR/" +) + +echo "Linux backend: $BACKEND_DIR/senlin-agent-api" +echo "Web build: $WEB_DIR"