-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
42 lines (33 loc) · 804 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
30
31
32
33
34
35
36
37
38
39
40
41
42
PWD := $(shell pwd)
VERSION := $(shell git describe --tags --always)
GIT_HASH := $(shell git log -1 --pretty=format:"%H")
BUILD_LDFLAGS :=
BUILD_LDFLAGS += -X main.Version=${VERSION}
BUILD_LDFLAGS += -X main.GitHash=${GIT_HASH}
DOCKER_IMAGE ?= "laggyluke/prometheus-reloader"
.PHONY: run
run:
go run \
cmd/main.go \
-config-file testdata/prometheus.yml \
-v 1
.PHONY: build
build:
go build \
-ldflags='$(BUILD_LDFLAGS)' \
-o out/prometheus-reloader \
cmd/main.go
.PHONY: docker-build
docker-build:
docker build \
--build-arg "VERSION=$(VERSION)" \
--build-arg "GIT_HASH=$(GIT_HASH)" \
--tag $(DOCKER_IMAGE):$(VERSION) \
--tag $(DOCKER_IMAGE):latest \
.
.PHONY: docker-run
docker-run:
docker run \
-it \
-v $(PWD)/testdata:/etc/prometheus \
$(DOCKER_IMAGE):latest