#!/usr/bin/env bash
set -e
cd "$(dirname "$0")"

COMMIT="$(git describe --always --dirty 2>/dev/null || echo 'unknown')"
BUILD_TIME="$(date -u +%Y%m%dT%H%M%SZ)"
VERSION="${COMMIT}-${BUILD_TIME}"

echo "Building udpstreamer-webui ${VERSION}..."
go build -ldflags "-X main.version=${VERSION}" -o udpstreamer-webui .

echo "Starting udpstreamer-webui ${VERSION}..."
exec ./udpstreamer-webui "$@"
