Skip to content

Commit

Permalink
Add crossbuild script
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Volz <[email protected]>
  • Loading branch information
juliusv committed Oct 30, 2020
1 parent 0659ca3 commit 0118435
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions crossbuild.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env bash

set -e
set -u

platforms=(
"linux/amd64"
"linux/386"
"darwin/amd64"
"windows/amd64"
"windows/386"
"freebsd/amd64"
"freebsd/386"
"openbsd/amd64"
"openbsd/386"
"netbsd/amd64"
"netbsd/386"
"dragonfly/amd64"
"linux/arm"
"linux/arm64"
"freebsd/arm"
"openbsd/arm"
"linux/mips64"
"linux/mips64le"
"netbsd/arm"
"linux/ppc64"
"linux/ppc64le"
"linux/s390x"
)

for platform in "${platforms[@]}"
do
platform_split=(${platform//\// })
GOOS=${platform_split[0]}
GOARCH=${platform_split[1]}
output_name="prometheus_demo_service-$(git describe --tags).${GOOS}-${GOARCH}"
if [ $GOOS = "windows" ]; then
output_name+='.exe'
fi

echo "Building ${output_name}..."
env GOOS=$GOOS GOARCH=$GOARCH go build -o "${output_name}"
done

0 comments on commit 0118435

Please sign in to comment.