2
2
3
3
set -e
4
4
5
- GORELEASER_VERSION=" v2.8.0 "
5
+ GORELEASER_VERSION=" v2.8.2 "
6
6
USER_UID=$( id -u)
7
7
8
8
rm -fr work
54
54
rm -fr webui/dist webui/node_modules api/static/assets/css/ api/static/assets/js/ api/api-bindata.go api/api-packr.go api/packrd/
55
55
fi
56
56
57
- if [ " ${SKIP_JS} " != " 1" -a " ${ONLY_GO} " != " 1" ]; then
57
+ if [ " ${SKIP_JS} " != " 1" ] && [ " ${ONLY_GO} " != " 1" ]; then
58
58
echo " Building webui"
59
59
mkdir -p api/static/assets/css/ api/static/assets/js/ webui/node_modules
60
60
docker run --rm -e HOME=/go/pkg/node \
79
79
80
80
export GLOUTON_VERSION
81
81
82
- COMMIT=` git rev-parse --short HEAD || echo " unknown" `
83
-
82
+ COMMIT=$( git rev-parse --short HEAD || echo " unknown" )
84
83
85
84
if [ " ${ONLY_JS} " = " 1" ]; then
86
85
exit 0
@@ -90,21 +89,23 @@ echo "Building Go binary"
90
89
if [ " ${ONLY_DOCKER_FAST} " = " 1" ]; then
91
90
echo " Building a Docker image using ./glouton"
92
91
sed ' s@COPY dist/glouton_linux_.*/glouton /glouton.@COPY glouton /glouton.@' Dockerfile | docker buildx build ${GLOUTON_BUILDX_OPTION} -f - .
93
- elif [ " ${ONLY_GO} " = " 1" -a " ${WITH_RACE} " != " 1" ]; then
92
+ elif [ " ${ONLY_GO} " = " 1" ] && [ " ${WITH_RACE} " != " 1" ]; then
94
93
docker run --rm -e HOME=/go/pkg -e CGO_ENABLED=0 \
95
94
-v $( pwd) :/src -w /src ${GO_MOUNT_CACHE} \
96
95
--entrypoint ' ' \
97
96
goreleaser/goreleaser:${GORELEASER_VERSION} \
98
97
tini -g -- sh -exc "
98
+ git config --global --add safe.directory /src
99
99
go build -ldflags='-X main.version=${GLOUTON_VERSION} -X main.commit=${COMMIT} ' .
100
100
chown $USER_UID glouton
101
101
"
102
- elif [ " ${ONLY_GO} " = " 1" -a " ${WITH_RACE} " = " 1" ]; then
102
+ elif [ " ${ONLY_GO} " = " 1" ] && [ " ${WITH_RACE} " = " 1" ]; then
103
103
docker run --rm -e HOME=/go/pkg -e CGO_ENABLED=1 \
104
104
-v $( pwd) :/src -w /src ${GO_MOUNT_CACHE} \
105
105
--entrypoint ' ' \
106
106
goreleaser/goreleaser:${GORELEASER_VERSION} \
107
107
tini -g -- sh -exc "
108
+ git config --global --add safe.directory /src
108
109
go build -ldflags='-X main.version=${GLOUTON_VERSION} -X main.commit=${COMMIT} -linkmode external -extldflags=-static' -race .
109
110
chown $USER_UID glouton
110
111
"
0 commit comments