scc-operator/scripts/build

21 lines
630 B
Bash
Executable File

#!/bin/bash
set -e
source $(dirname $0)/version
cd $(dirname $0)/..
mkdir -p bin
if [ "$(uname)" = "Linux" ]; then
OTHER_LINKFLAGS="-extldflags -static -s -w"
fi
LINKFLAGS="-X github.com/rancher/scc-operator/cmd/operator/version.Version=$VERSION"
LINKFLAGS="-X github.com/rancher/scc-operator/cmd/operator/version.Commit=$COMMIT $LINKFLAGS"
LINKFLAGS="-X github.com/rancher/scc-operator/cmd/operator/version.Date=$(date -u +"%Y-%m-%dT%H:%M:%SZ") $LINKFLAGS"
echo "Starting bin build for scc-operator"
CGO_ENABLED=0 go build -ldflags "$LINKFLAGS $OTHER_LINKFLAGS" -o "bin/scc-operator" ./cmd/operator/main.go
echo "Done"