mirror of
https://github.com/bjdgyc/anylink.git
synced 2025-08-08 17:42:50 +08:00
添加 deploy 部署脚本
优化应用易用性
This commit is contained in:
32
docker/init_build.sh
Normal file
32
docker/init_build.sh
Normal 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
|
Reference in New Issue
Block a user