forked from winkingzhang/goGate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·41 lines (38 loc) · 1.09 KB
/
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
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
TARGET=$1
if [ -z $TARGET ]
then
TARGET="build"
fi
CGO_ENABLED=0
#GOOS=linux
case $TARGET in
build)
rm -rf dist
go build -a -installsuffix cgo -o dist/goGate main.go
;;
buildstatic)
rm -rf dist
mkdir -p dist/static
go build -ldflags "-s" -a -tags netgo -installsuffix netgo -o dist/static/goGate main.go
;;
builddocker)
rm -rf dist
docker build -t "winkingzhang/gogate" -f Dockerfile .
;;
builddockeralpine)
rm -rf dist
mkdir -p dist/alpine
go build -a -tags netgo -installsuffix netgo -o dist/alpine/goGate main.go
docker build -t "winkingzhang/gogate:alpine" -f Dockerfile.alpine .
;;
builddockerstatic)
rm -rf dist
mkdir -p dist/static
go build -ldflags "-s" -a -tags netgo -installsuffix netgo -o dist/static/goGate main.go
docker build -t "winkingzhang/gogate:static" -f Dockerfile.static .
;;
*)
echo $"Usage: $0 {build|buildstatic|builddocker|builddockeralpine|builddockerstatic}"
exit 1
esac