35 lines
606 B
Batchfile
35 lines
606 B
Batchfile
@echo off
|
|
chcp 65001 >nul
|
|
|
|
setlocal enabledelayedexpansion
|
|
|
|
set OUTPUT=server
|
|
set BIN_DIR=bin
|
|
|
|
echo === Build Go backend (Linux amd64) ===
|
|
|
|
set GOOS=linux
|
|
set GOARCH=amd64
|
|
set CGO_ENABLED=0
|
|
|
|
go build -ldflags="-s -w" -o "%BIN_DIR%/%OUTPUT%" ./cmd/server/
|
|
|
|
if errorlevel 1 (
|
|
echo Build failed, error code: %errorlevel%
|
|
exit /b %errorlevel%
|
|
)
|
|
|
|
echo === Build complete ===
|
|
echo Output: %BIN_DIR%/%OUTPUT%
|
|
|
|
if exist config\config-prod.yaml (
|
|
copy config\config-prod.yaml "%BIN_DIR%\" >nul
|
|
) else (
|
|
echo Warning: config-prod.yaml not found
|
|
)
|
|
|
|
echo === Deploy files ===
|
|
dir "%BIN_DIR%"
|
|
|
|
endlocal
|