Added a cross compilation target as well as push

This commit is contained in:
Jim Tilander 2017-02-14 22:41:26 -08:00 committed by Will Rouesnel
parent 623d2eb6de
commit 03ee288c3a
1 changed files with 7 additions and 1 deletions

View File

@ -5,6 +5,9 @@ CONTAINER_NAME ?= wrouesnel/postgres_exporter:latest
all: vet test postgres_exporter
# Cross compilation (e.g. if you are on a Mac)
cross: docker-build docker
# Simple go build
postgres_exporter: $(GO_SRC)
CGO_ENABLED=0 go build -a -ldflags "-extldflags '-static' -X main.Version=$(shell git describe --dirty)" -o postgres_exporter .
@ -37,4 +40,7 @@ docker-build: postgres_exporter
/bin/bash -c "make >&2 && chown $$SHELL_UID:$$SHELL_GID ./postgres_exporter"
docker build -t $(CONTAINER_NAME) .
.PHONY: docker-build docker test vet
push:
docker push $(CONTAINER_NAME)
.PHONY: docker-build docker test vet push cross