#!/bin/sh # script/build: build the frontend for production into dist/, then the # static netwatch-server binary into the repo root, with its version # stamped in. set -eu ROOT="$(cd "$(dirname "$0")/.." && pwd -P)" main() { cd "$ROOT" yarn build # VERSION comes from the environment. Unset or empty, it is git # describe, or "dev" where there is no git or no repository history. version="${VERSION:-$(git describe --always --dirty 2>/dev/null || echo dev)}" CGO_ENABLED=0 go build -trimpath \ -ldflags "-s -w -X main.Version=$version" \ -o netwatch-server ./cmd/netwatch-server/ } main "$@"