1
0
mirror of https://github.com/pcvolkmer/docker-pps.git synced 2025-04-19 09:46:50 +00:00
docker-pps/scripts/build.sh
Paul-Christian Volkmer e4850f270d Add makefile and build script
Binary will be build in corresponding GOOS-GOARCH folder.

Install command will build and install binary for current platform until
GOOS and/or GOARCH env var is set.
2022-03-04 11:08:48 +01:00

33 lines
432 B
Bash

#!/bin/sh
set -eu
TARGET=${TARGET:-"target"}
GOOS="$(go env GOOS)"
GOARCH="$(go env GOARCH)"
TARGET="$TARGET/${GOOS}-${GOARCH}/docker-pps"
if [ "${GOOS}" = "windows" ]; then
TARGET="${TARGET}.exe"
fi
case "$1" in
fmt)
go fmt $(go list)
;;
clean)
rm -rf ./target
;;
build)
go build -o "${TARGET}"
;;
install)
go install
;;
*)
echo "Usage: $0 {fmt|clean|build|install}"
exit 1
esac