Files
2025-12-14 15:25:31 +08:00

30 lines
666 B
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# 编译脚本 - 兼容旧版本 GLIBC
echo "开始编译 mengyamonitor-backend..."
# 禁用 CGO使用纯 Go 编译(不依赖系统 C 库)
export CGO_ENABLED=0
# 设置目标平台
export GOOS=linux
export GOARCH=amd64
# 编译(静态链接)
go build -ldflags="-s -w" -o mengyamonitor-backend .
if [ $? -eq 0 ]; then
echo "编译成功!"
echo "二进制文件: mengyamonitor-backend"
echo ""
echo "检查文件信息:"
file mengyamonitor-backend
echo ""
echo "检查依赖库:"
ldd mengyamonitor-backend 2>/dev/null || echo "静态链接,无外部依赖"
else
echo "编译失败!"
exit 1
fi