forked from opencomputeproject/OSF-OSFCI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_go.sh
60 lines (58 loc) · 1.79 KB
/
build_go.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash
# This script is to build the go modules from a compile server
# Mandatory input parameters are:
# Relative path to osfci github local fork (ex: ../osfci)
# Absolute path to an installation director (ex: /usr/local/production)
# Go must be installed
mypath=`realpath $1`
local=`realpath .`
#export GOPATH=$local:$mypath
#echo $GOPATH
if [ -f "go.mod" ] ; then
echo "deleting go.mod in build dir\n"
rm -f "go.mod"
fi
if [ -f "go.sum" ] ; then
echo "deleting go.sum in build dir\n"
rm -f "go.sum"
fi
cd $1/base/
pwd
go get -u go.uber.org/zap
go get gopkg.in/natefinch/lumberjack.v2
go mod init base/base
#go mod tidy
go mod tidy -compat=1.17
cd /home/ciadmin/build/
pwd
go get golang.org/x/crypto/acme/autocert
go get golang.org/x/sys/unix
go get -v github.com/go-session/session
go mod init github.com/spf13
go mod edit -replace base/base=$1/base
go mod tidy
echo "Building Server.go ...\n"
go get github.com/spf13/viper
go get golang.org/x/crypto/acme/autocert
go get github.com/fsnotify/[email protected]
go mod download github.com/spf13/viper
go get base/base
go build -ldflags="-s" $1/gateway/server.go
echo "Building ctrl1.go ...\n"
go build -ldflags="-s" $1/ctrl/ctrl1.go
echo "Building user.go ...\n"
go get github.com/gorilla/sessions
go get github.com/okta/okta-jwt-verifier-golang
go build -ldflags="-s" $1/gateway/user.go
echo "Building storage.go ...\n"
go build -ldflags="-s" $1/gateway/backend/storage.go
tar cvf gateway.tar $1/gateway/html $1/gateway/css/ $1/gateway/images/ $1/gateway/js
go get github.com/docker/docker/api/types
go get github.com/docker/docker/client
echo "Building compile.go ...\n"
go build -ldflags="-s" $1/compile/compile.go
if [ -f "$1/base/go.mod" ] ; then
echo "Deleting go.mod in base after build"
rm -f "$1/base/go.mod"
fi
exit 1