From 14ec6755492c2bf42b8ff5db0a9e03494b2d6f16 Mon Sep 17 00:00:00 2001 From: Ed Schouten Date: Mon, 24 Apr 2017 09:10:45 +0200 Subject: [PATCH] Add a script for building a statically linked version of the exporter. --- build_static.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 build_static.sh diff --git a/build_static.sh b/build_static.sh new file mode 100755 index 0000000..c5f4232 --- /dev/null +++ b/build_static.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +docker run -i -v `pwd`:/openvpn_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 openvpn_exporter. +cd /openvpn_exporter +export GOPATH=/gopath +go get -d ./... +go build --ldflags '-extldflags "-static"' +strip openvpn_exporter +EOF