17 lines
379 B
Bash
Executable File
17 lines
379 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
BINARY="${BINARY:-gateway}"
|
|
ENTRYPOINT="${ENTRYPOINT:-./main.go}"
|
|
LDFLAGS="${LDFLAGS:--w -s}"
|
|
GOOS="${GOOS:-linux}"
|
|
|
|
echo "=> Building ${BINARY} (CGO_ENABLED=${CGO_ENABLED:-1} GOOS=${GOOS})"
|
|
|
|
CGO_ENABLED="${CGO_ENABLED:-1}" GOOS="${GOOS}" go build \
|
|
-ldflags="${LDFLAGS}" \
|
|
-o "${BINARY}" \
|
|
"${ENTRYPOINT}"
|
|
|
|
echo "=> Done: ${BINARY}"
|