postfix_exporter/build_static.sh
Lukasz Jagiello 63db16cbcb
Build binary with official golang image
Ubuntu 16.04 use a very old Go version (1.6). It's better to use
official golang docker image with the latest golang release - 1.12.

Additionally I was able to fix #16 where `--systemd.enable` wasn't
working correctly.
2019-03-07 15:08:50 -08:00

16 lines
285 B
Bash
Executable File

#!/bin/sh
docker run -i -v `pwd`:/postfix_exporter golang:1.12 /bin/sh << 'EOF'
set -ex
# Install prerequisites for the build process.
apt-get update -q
apt-get install -yq libsystemd-dev
cd /postfix_exporter
go get -d ./...
go build -a -tags static_all
strip postfix_exporter
EOF