重命名节点与网关入口包;添加构建和启动边缘节点的 PowerShell 脚本
This commit is contained in:
56
scripts/build-edge.ps1
Normal file
56
scripts/build-edge.ps1
Normal file
@@ -0,0 +1,56 @@
|
||||
# Script to build the edge client for different platforms
|
||||
|
||||
# 设置Go环境变量
|
||||
$env:CGO_ENABLED = 0
|
||||
|
||||
# 设置输出路径
|
||||
$outputPath = ".\bin"
|
||||
if (-not (Test-Path -Path $outputPath)) {
|
||||
New-Item -ItemType Directory -Path $outputPath
|
||||
}
|
||||
|
||||
# 显示构建信息
|
||||
Write-Host "开始构建 edge 客户端..." -ForegroundColor Green
|
||||
|
||||
# 构建 Windows AMD64 版本
|
||||
Write-Host "正在构建 Windows AMD64 版本..." -ForegroundColor Cyan
|
||||
$env:GOOS = "windows"
|
||||
$env:GOARCH = "amd64"
|
||||
go build -ldflags="-w -s" -o "$outputPath\proxy_edge_win_amd64.exe" .\cmd\edge\main.go
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Host "Windows AMD64 版本构建成功!" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host "Windows AMD64 版本构建失败!" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
|
||||
# 构建 Linux AMD64 版本
|
||||
Write-Host "正在构建 Linux AMD64 版本..." -ForegroundColor Cyan
|
||||
$env:GOOS = "linux"
|
||||
$env:GOARCH = "amd64"
|
||||
go build -ldflags="-w -s" -o "$outputPath\proxy_edge_linux_amd64" .\cmd\edge\main.go
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Host "Linux AMD64 版本构建成功!" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host "Linux AMD64 版本构建失败!" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
|
||||
# 构建 Linux ARM64 版本
|
||||
Write-Host "正在构建 Linux ARM64 版本..." -ForegroundColor Cyan
|
||||
$env:GOOS = "linux"
|
||||
$env:GOARCH = "arm64"
|
||||
go build -ldflags="-w -s" -o "$outputPath\proxy_edge_linux_arm64" .\cmd\edge\main.go
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Host "Linux ARM64 版本构建成功!" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host "Linux ARM64 版本构建失败!" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
|
||||
# 构建完成
|
||||
Write-Host "所有平台版本构建完成!" -ForegroundColor Green
|
||||
Write-Host "可执行文件位于: $outputPath" -ForegroundColor Yellow
|
||||
|
||||
# 显示构建结果
|
||||
Get-ChildItem -Path $outputPath | Where-Object { $_.Name -like "proxy_edge_*" } | Format-Table Name, Length, LastWriteTime
|
||||
Reference in New Issue
Block a user