Add a script for building a statically linked executable.
This is the script we use at Kumina to build binaries that can be deployed across our cluster easily.
This commit is contained in:
parent
11f53c8612
commit
91ad2ff620
|
@ -0,0 +1,17 @@
|
|||
#!/bin/sh
|
||||
|
||||
docker run -i -v `pwd`:/unbound_exporter alpine:edge /bin/sh << 'EOF'
|
||||
set -ex
|
||||
|
||||
# Install prerequisites for the build process.
|
||||
apk update
|
||||
apk add ca-certificates git go libc-dev
|
||||
update-ca-certificates
|
||||
|
||||
# Build the unbound_exporter.
|
||||
cd /unbound_exporter
|
||||
export GOPATH=/gopath
|
||||
go get -d ./...
|
||||
go build --ldflags '-extldflags "-static"'
|
||||
strip unbound_exporter
|
||||
EOF
|
Loading…
Reference in New Issue