forked from prometheus-community/elasticsearch_exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
29 lines (21 loc) · 725 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
DATE = $(shell date +%Y%m%d%H%M)
IMAGE ?= Kuckkuck/elasticsearch_explorer
VERSION = v$(DATE)
GOOS ?= $(shell go env | grep GOOS | cut -d'"' -f2)
BINARY := elasticsearch_explorer
LDFLAGS := -X github.com/Kuckkuck/elasticsearch_explorer/main.VERSION=$(VERSION)
GOFLAGS := -ldflags "$(LDFLAGS)"
SRCDIRS := .
PACKAGES := $(shell find $(SRCDIRS) -type d)
GOFILES := $(addsuffix /*.go,$(PACKAGES))
GOFILES := $(wildcard $(GOFILES))
.PHONY: all clean
all: bin/$(GOOS)/$(BINARY)
bin/%/$(BINARY): $(GOFILES) Makefile
GOOS=$* GOARCH=amd64 go build $(GOFLAGS) -v -i -o bin/$*/$(BINARY) .
build: bin/linux/$(BINARY)
docker build -t $(IMAGE):$(VERSION) .
push:
docker push $(IMAGE):$(VERSION)
clean:
rm -rf bin/*