前后端构建逻辑优化:新增Node.js支持,完善Dockerfile,更新构建与验证流程

This commit is contained in:
2026-01-27 15:44:02 +08:00
parent d757dbd39d
commit 89bdfbd48e
8 changed files with 121 additions and 15 deletions

View File

@@ -1,6 +1,21 @@
# 切换到项目根目录
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Definition
if ($ScriptDir) { Set-Location (Join-Path $ScriptDir "..") }
$AppName = "BingPaper"
$OutputDir = "output"
Write-Host "开始构建前端..."
Push-Location webapp
npm install
npm run build
if ($LASTEXITCODE -ne 0) {
Write-Host "前端构建失败" -ForegroundColor Red
Pop-Location
exit $LASTEXITCODE
}
Pop-Location
Write-Host "开始构建 $AppName 多平台二进制文件..."
if (Test-Path $OutputDir) {
@@ -38,7 +53,7 @@ foreach ($Platform in $Platforms) {
$env:GOOS = $OS
$env:GOARCH = $Arch
$env:CGO_ENABLED = "0"
go build -o (Join-Path $PackageDir $BinaryName) main.go
go build -ldflags="-s -w" -o (Join-Path $PackageDir $BinaryName) main.go
if ($LASTEXITCODE -eq 0) {
Write-Host " $OS/$Arch 编译成功"