添加 deploy 部署脚本

优化应用易用性
This commit is contained in:
bjdgyc
2024-01-31 17:44:35 +08:00
parent d45ecbf3b7
commit 2fc3c33880
20 changed files with 297 additions and 88 deletions

32
docker/init_build.sh Normal file
View File

@@ -0,0 +1,32 @@
#!/bin/sh
set -x
#TODO 本地打包时使用镜像
if [[ $CN == "yes" ]]; then
sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories
export GOPROXY=https://goproxy.cn
fi
apk add tzdata gcc musl-dev upx
uname -a
env
date
cd /server
go mod tidy
echo "start build"
ldflags="-s -w -extldflags '-static' -X main.appVer=$appVer -X main.commitId=$commitId -X main.buildDate=$(date -Iseconds)"
go build -o anylink -trimpath -ldflags "$ldflags"
ls -lh /server/
# 压缩文件
upx -9 -k anylink
/server/anylink -v