2022-09-20 21:48:07 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2021-10-28 11:18:13 +00:00
|
|
|
set -x
|
2019-01-30 22:37:16 +00:00
|
|
|
|
2021-10-28 11:18:13 +00:00
|
|
|
mkdir -p dist
|
2019-01-30 22:37:16 +00:00
|
|
|
|
2022-07-14 23:09:38 +00:00
|
|
|
# populate tool versions
|
|
|
|
BUILDNUMBER="N/A"
|
|
|
|
CONTAINER_IMAGE_TAG="N/A"
|
|
|
|
NODE_VERSION="0"
|
|
|
|
YARN_VERSION="0"
|
|
|
|
WEBPACK_VERSION="0"
|
|
|
|
GO_VERSION="0"
|
|
|
|
|
2021-10-28 11:18:13 +00:00
|
|
|
cd api
|
|
|
|
# the go get adds 8 seconds
|
2019-01-30 22:37:16 +00:00
|
|
|
go get -t -d -v ./...
|
|
|
|
|
2021-10-28 11:18:13 +00:00
|
|
|
# the build takes 2 seconds
|
|
|
|
GOOS=$1 GOARCH=$2 CGO_ENABLED=0 go build \
|
|
|
|
--installsuffix cgo \
|
2022-09-20 21:48:07 +00:00
|
|
|
--gcflags="-trimpath $(pwd)" \
|
2022-07-14 23:09:38 +00:00
|
|
|
--ldflags "-s \
|
2022-09-20 21:48:07 +00:00
|
|
|
--X 'github.com/portainer/portainer/api/build.BuildNumber=${BUILDNUMBER}' \
|
|
|
|
--X 'github.com/portainer/portainer/api/build.ImageTag=${CONTAINER_IMAGE_TAG}' \
|
|
|
|
--X 'github.com/portainer/portainer/api/build.NodejsVersion=${NODE_VERSION}' \
|
|
|
|
--X 'github.com/portainer/portainer/api/build.YarnVersion=${YARN_VERSION}' \
|
|
|
|
--X 'github.com/portainer/portainer/api/build.WebpackVersion=${WEBPACK_VERSION}' \
|
|
|
|
--X 'github.com/portainer/portainer/api/build.GoVersion=${GO_VERSION}'" \
|
2021-10-28 11:18:13 +00:00
|
|
|
-o "../dist/portainer" \
|
|
|
|
./cmd/portainer/
|