build: add Linux web and backend bundle script
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -10,3 +10,4 @@ coverage/
|
|||||||
test-results/
|
test-results/
|
||||||
playwright-report/
|
playwright-report/
|
||||||
apps/desktop/release/
|
apps/desktop/release/
|
||||||
|
.builds/
|
||||||
|
|||||||
28
scripts/build-web-linux.sh
Executable file
28
scripts/build-web-linux.sh
Executable file
@@ -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"
|
||||||
Reference in New Issue
Block a user