From 93c12938e97c26abc7114b526fd9b9fefcf5837b Mon Sep 17 00:00:00 2001
From: Richard Mitchell <richard.j.mitchell@gmail.com>
Date: Mon, 24 Sep 2018 21:39:33 +0100
Subject: [PATCH] Use promu for dockerized builds

---
 Dockerfile.build.amd64.glibc | 3 ++-
 Dockerfile.build.amd64.musl  | 3 ++-
 Dockerfile.build.arm7.glibc  | 3 ++-
 Dockerfile.build.arm7.musl   | 3 ++-
 Makefile                     | 1 +
 5 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/Dockerfile.build.amd64.glibc b/Dockerfile.build.amd64.glibc
index facfbb2..8b053c4 100644
--- a/Dockerfile.build.amd64.glibc
+++ b/Dockerfile.build.amd64.glibc
@@ -1,7 +1,8 @@
 FROM amd64/golang:stretch
 
+RUN go get -u github.com/prometheus/promu
 COPY . /go/src/github.com/mitchellrj/hue_exporter
 WORKDIR /go/src/github.com/mitchellrj/hue_exporter
 
 VOLUME /build
-CMD go build -o /build/hue_exporter.amd64
+CMD promu build && mv hue_exporter /build/hue_exporter.amd64
diff --git a/Dockerfile.build.amd64.musl b/Dockerfile.build.amd64.musl
index ae41e33..924a2cb 100644
--- a/Dockerfile.build.amd64.musl
+++ b/Dockerfile.build.amd64.musl
@@ -1,7 +1,8 @@
 FROM amd64/golang:alpine
 
+RUN go get -u github.com/prometheus/promu
 COPY . /go/src/github.com/mitchellrj/hue_exporter
 WORKDIR /go/src/github.com/mitchellrj/hue_exporter
 
 VOLUME /build
-CMD go build -o /build/hue_exporter.amd64.musl
+CMD promu build && mv hue_exporter /build/hue_exporter.amd64.musl
diff --git a/Dockerfile.build.arm7.glibc b/Dockerfile.build.arm7.glibc
index afa956b..15f7f47 100644
--- a/Dockerfile.build.arm7.glibc
+++ b/Dockerfile.build.arm7.glibc
@@ -1,7 +1,8 @@
 FROM arm32v7/golang:stretch
 
+RUN go get -u github.com/prometheus/promu
 COPY . /go/src/github.com/mitchellrj/hue_exporter
 WORKDIR /go/src/github.com/mitchellrj/hue_exporter
 
 VOLUME /build
-CMD go build -o /build/hue_exporter.arm7
+CMD promu build && mv hue_exporter /build/hue_exporter.arm7
diff --git a/Dockerfile.build.arm7.musl b/Dockerfile.build.arm7.musl
index be51123..13c47a5 100644
--- a/Dockerfile.build.arm7.musl
+++ b/Dockerfile.build.arm7.musl
@@ -2,8 +2,9 @@ FROM armhf/alpine:latest
 
 RUN apk add --no-cache git go musl-dev && mkdir /go
 ENV GOPATH=/go
+RUN go get -u github.com/prometheus/promu
 COPY . /go/src/github.com/mitchellrj/hue_exporter
 WORKDIR /go/src/github.com/mitchellrj/hue_exporter
 
 VOLUME /build
-CMD go build -o /build/hue_exporter.arm7.musl
+CMD promu build && mv hue_exporter /build/hue_exporter.arm7.musl
diff --git a/Makefile b/Makefile
index 4858f01..8fcbbfa 100644
--- a/Makefile
+++ b/Makefile
@@ -54,4 +54,5 @@ push:
 	docker push mitchellrj/hue_exporter:latest-arm7
 	docker push mitchellrj/hue_exporter:$$(build/hue_exporter.darwin -V)-arm7
 
+DEFAULT: all
 .PHONY: all style test format vet staticcheck promu build
-- 
GitLab