casdoor/build.sh

13 lines
553 B
Bash
Raw Permalink Normal View History

2022-04-13 14:04:40 +08:00
#!/bin/bash
#try to connect to google to determine whether user need to use proxy
curl www.google.com -o /dev/null --connect-timeout 5 2> /dev/null
2022-04-13 14:04:40 +08:00
if [ $? == 0 ]
then
echo "Successfully connected to Google, no need to use Go proxy"
2022-04-13 14:04:40 +08:00
else
echo "Google is blocked, Go proxy is enabled: GOPROXY=https://goproxy.cn,direct"
export GOPROXY="https://goproxy.cn,direct"
fi
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o server_linux_amd64 .
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="-w -s" -o server_linux_arm64 .