29 lines
679 B
Batchfile
29 lines
679 B
Batchfile
@echo off
|
||
setlocal
|
||
cd /d "%~dp0"
|
||
|
||
where go >nul 2>&1
|
||
if errorlevel 1 (
|
||
echo [错误] 未找到 go,请先安装 Go 并加入 PATH
|
||
exit /b 1
|
||
)
|
||
|
||
if not exist release mkdir release
|
||
|
||
set GOOS=linux
|
||
set GOARCH=amd64
|
||
set CGO_ENABLED=0
|
||
|
||
echo 正在编译 Linux amd64 release\mengyamonitor-central-linux-amd64 ...
|
||
go build -trimpath -ldflags="-s -w" -o release\mengyamonitor-central-linux-amd64 .
|
||
if errorlevel 1 (
|
||
echo [错误] go build 失败
|
||
exit /b 1
|
||
)
|
||
|
||
echo 完成: %cd%\release\mengyamonitor-central-linux-amd64
|
||
echo.
|
||
echo 可选:用预编译镜像启动(不再在 Docker 里编译)
|
||
echo docker compose -f docker-compose.binary.yml up -d --build
|
||
exit /b 0
|