-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
29 lines (16 loc) · 831 Bytes
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env bash
set -x
Version='v1.7.2'
GitHash=`git rev-parse HEAD`
BuildTime=`date +'%Y.%m.%d.%H%M%S'`
LDFlags=" \
-X 'ws-tun-vpn/pkg.Version=${Version}' \
-X 'ws-tun-vpn/pkg.GitHash=${GitHash}' \
-X 'ws-tun-vpn/pkg.BuildTime=${BuildTime}' \
"
go build -ldflags "$LDFlags" -o ws-tun-vpn-server server/main.go
go build -ldflags "$LDFlags" -o ws-tun-vpn-client client/main.go
echo 'build done.'
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -gcflags=-trimpath=$GOPATH -asmflags=-trimpath=$GOPATH -ldflags "-w -s" -o wtvs server/cmd.go
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -gcflags=-trimpath=$GOPATH -asmflags=-trimpath=$GOPATH -ldflags "-w -s" -o wtvc client/cmd.go
docker buildx build --platform linux/amd64,linux/arm64/v8 --rm --push -t 1228022817/ws-tun-vpn-server:latest -f Dockerfile .