Merge pull request #30 from ljagiello/build-with-golang-image

Build binary with official golang image
This commit is contained in:
Tim Stoop 2019-07-25 14:03:19 +02:00 committed by GitHub
commit 0a237f860d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,17 +1,15 @@
#!/bin/sh
docker run -i -v `pwd`:/postfix_exporter ubuntu:16.04 /bin/sh << 'EOF'
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 git golang-go libsystemd-dev
apt-get install -yq libsystemd-dev
mkdir /go
export GOPATH=/go
cd /postfix_exporter
go get -d ./...
go build --ldflags '-extldflags "-static"'
go build -a -tags static_all
strip postfix_exporter
EOF