forked from sapcc/mosquitto-exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
29 lines (25 loc) · 794 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
PKG_NAME:=github.com/sapcc/mosquitto-exporter
BUILD_DIR:=bin
MOSQUITTO_EXPORTER_BINARY:=$(BUILD_DIR)/mosquitto_exporter
IMAGE := sapcc/mosquitto-exporter
VERSION=0.2.0
LDFLAGS=-s -w -X main.Version=$(VERSION) -X main.GITCOMMIT=`git rev-parse --short HEAD`
CGO_ENABLED=0
GOARCH=amd64
.PHONY: help
help:
@echo
@echo "Available targets:"
@echo " * build - build the binary, output to $(ARC_BINARY)"
@echo " * linux - build the binary, output to $(ARC_BINARY)"
@echo " * docker - build docker image"
.PHONY: build
build:
@mkdir -p $(BUILD_DIR)
go build -o $(MOSQUITTO_EXPORTER_BINARY) -ldflags="$(LDFLAGS)" $(PKG_NAME)
linux: export GOOS=linux
linux: build
docker: linux
docker build -t $(IMAGE):$(VERSION) .
push:
docker push $(IMAGE):$(VERSION)