Skip to content

Commit

Permalink
Fix build process and cut new version
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchellrj committed Mar 19, 2019
1 parent cea677b commit 50c0f36
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 68 deletions.
14 changes: 10 additions & 4 deletions .promu.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
go:
version: 1.12.0
cgo: false
repository:
path: github.com/mitchellrj/hue_exporter
build:
flags: -a -tags 'netgo static_build'
ldflags: |
-s
-w
-extldflags "-static"
-X {{repoPath}}/vendor/github.com/prometheus/common/version.Version={{.Version}}
-X {{repoPath}}/vendor/github.com/prometheus/common/version.Revision={{.Revision}}
-X {{repoPath}}/vendor/github.com/prometheus/common/version.Branch={{.Branch}}
Expand All @@ -14,7 +19,8 @@ tarball:
- LICENSE
crossbuild:
platforms:
- linux/amd64
- darwin/amd64
- linux/arm
- linux/arm64
- darwin/amd64
- linux/amd64
- linux/armv6
- linux/armv7
- linux/arm64
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# v0.2.2 (2019-03-19)

* Add counter metric for bridge restarts
* Fix build info metrics for dockerized builds
* Fix crossbuilds

# v0.2.1 (2018-08-11)

Use musl builds for alpine images.
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.amd64
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM alpine:latest
MAINTAINER Richard Mitchell <[email protected]>

COPY ./build/hue_exporter.amd64.musl /bin/hue_exporter
COPY ./.build/linux-amd64/hue_exporter /bin/hue_exporter
COPY hue_exporter.example.yml /etc/hue_exporter/config.yml

EXPOSE 9366
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.arm7
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM armhf/alpine:latest
MAINTAINER Richard Mitchell <[email protected]>

COPY ./build/hue_exporter.arm7.musl /bin/hue_exporter
COPY ./.build/linux-armv7/hue_exporter /bin/hue_exporter
COPY hue_exporter.example.yml /etc/hue_exporter/config.yml

EXPOSE 9366
Expand Down
8 changes: 0 additions & 8 deletions Dockerfile.build.amd64.glibc

This file was deleted.

8 changes: 0 additions & 8 deletions Dockerfile.build.amd64.musl

This file was deleted.

8 changes: 0 additions & 8 deletions Dockerfile.build.arm7.glibc

This file was deleted.

10 changes: 0 additions & 10 deletions Dockerfile.build.arm7.musl

This file was deleted.

41 changes: 14 additions & 27 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
PREFIX ?= $(shell pwd)
VERSION ?= $(shell cat VERSION)

all: style staticcheck build test

style:
Expand All @@ -19,40 +22,24 @@ promu:
GOOS= GOARCH= go get -u github.com/prometheus/promu

build: promu
promu build

dist: darwin amd64 arm7 amd64-musl arm7-musl docker

darwin: build
cp hue_exporter build/hue_exporter.darwin

amd64:
docker build --pull -f Dockerfile.build.amd64.glibc -t hue_exporter_builder:latest .
docker run -v $$(pwd)/build:/build hue_exporter_builder:latest
promu build hue_exporter --prefix $(PREFIX)

arm7:
docker build --pull -f Dockerfile.build.arm7.glibc -t hue_exporter_builder:latest-arm .
docker run -v $$(pwd)/build:/build hue_exporter_builder:latest-arm
crossbuild:
promu crossbuild hue_exporter

amd64-musl:
docker build --pull -f Dockerfile.build.amd64.musl -t hue_exporter_builder:latest-musl .
docker run -v $$(pwd)/build:/build hue_exporter_builder:latest-musl

arm7-musl:
docker build --pull -f Dockerfile.build.arm7.musl -t hue_exporter_builder:latest-arm-musl .
docker run -v $$(pwd)/build:/build hue_exporter_builder:latest-arm-musl

docker:
docker: crossbuild
docker build --pull -f Dockerfile.amd64 -t mitchellrj/hue_exporter:latest .
docker tag mitchellrj/hue_exporter:latest mitchellrj/hue_exporter:$$(build/hue_exporter.darwin -V)
docker tag mitchellrj/hue_exporter:latest mitchellrj/hue_exporter:$(VERSION)
docker build --pull -f Dockerfile.arm7 -t mitchellrj/hue_exporter:latest-arm7 .
docker tag mitchellrj/hue_exporter:latest mitchellrj/hue_exporter:$$(build/hue_exporter.darwin -V)-arm7
docker tag mitchellrj/hue_exporter:latest mitchellrj/hue_exporter:$(VERSION)-arm7

dist: docker

push:
docker push mitchellrj/hue_exporter:latest
docker push mitchellrj/hue_exporter:$$(build/hue_exporter.darwin -V)
docker push mitchellrj/hue_exporter:$(VERSION)
docker push mitchellrj/hue_exporter:latest-arm7
docker push mitchellrj/hue_exporter:$$(build/hue_exporter.darwin -V)-arm7
docker push mitchellrj/hue_exporter:$(VERSION)-arm7

DEFAULT: all
.PHONY: all style test format vet staticcheck promu build
.PHONY: all style test format vet staticcheck promu build crossbuild dist docker push
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2.1
0.2.2

0 comments on commit 50c0f36

Please sign in to comment.