-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
72 lines (56 loc) · 3.15 KB
/
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
include .env
COLLECTOR := collector
VISUALIZER := visualizer
VERSION := $(shell git describe --always --dirty --tags 2>/dev/null || echo "undefined")
IMG_PREFIX := gargath/flameblock
all: $(COLLECTOR) $(VISUALIZER)
fmt:
GO111MODULE=on $(GO) fmt ./cmd/... ./pkg/...
GO111MODULE=on $(GOIMPORTS) -w ./cmd ./pkg
vet:
GO111MODULE=on $(GO) vet ./cmd/... ./pkg/...
lint:
@ echo "\033[36mLinting code\033[0m"
GO111MODULE=on $(LINTER) run --disable-all \
--exclude-use-default=false \
--enable=govet \
--enable=ineffassign \
--enable=deadcode \
--enable=golint \
--enable=goconst \
--enable=gofmt \
--enable=goimports \
--skip-dirs=pkg/client/ \
--deadline=120s \
--tests ./...
@ echo
generate: pkg/visualizer/visualizer-packr.go
$(COLLECTOR): fmt vet lint
GO111MODULE=on $(GO) build -ldflags "-X main.VERSION=${VERSION}" github.com/gargath/flameblock/cmd/collector
pkg/visualizer/visualizer-packr.go:
cd pkg/visualizer; $(PACKR2)
$(VISUALIZER): fmt vet lint generate
GO111MODULE=on $(GO) build -ldflags "-X main.VERSION=${VERSION}" github.com/gargath/flameblock/cmd/visualizer
docker-build: fmt vet lint generate
docker build --build-arg VERSION=${VERSION} -t ${IMG_PREFIX}-collector:${VERSION} -f deploy/docker/collector/Dockerfile .
@echo "\033[36mBuilt ${IMG_PREFIX}-collector:${VERSION}\033[0m"
docker build --build-arg VERSION=${VERSION} -t ${IMG_PREFIX}-visualizer:${VERSION} -f deploy/docker/visualizer/Dockerfile .
@echo "\033[36mBuilt ${IMG_PREFIX}-visualizer:${VERSION}\033[0m"
docker build --build-arg VERSION=${VERSION} -t ${IMG_PREFIX}-docs:${VERSION} -f deploy/docker/docs/Dockerfile .
@echo "\033[36mBuilt ${IMG_PREFIX}-docs:${VERSION}\033[0m"
TAGS ?= latest
docker-tag:
@IFS=","; tags=${TAGS}; for tag in $${tags}; do docker tag ${IMG_PREFIX}-collector:${VERSION} ${IMG_PREFIX}-collector:$${tag}; echo "\033[36mTagged $(IMG_PREFIX)-collector:$(VERSION) as $${tag}\033[0m"; done
@IFS=","; tags=${TAGS}; for tag in $${tags}; do docker tag ${IMG_PREFIX}-visualizer:${VERSION} ${IMG_PREFIX}-visualizer:$${tag}; echo "\033[36mTagged $(IMG_PREFIX)-visualizer:$(VERSION) as $${tag}\033[0m"; done
@IFS=","; tags=${TAGS}; for tag in $${tags}; do docker tag ${IMG_PREFIX}-docs:${VERSION} ${IMG_PREFIX}-docs:$${tag}; echo "\033[36mTagged $(IMG_PREFIX)-docs:$(VERSION) as $${tag}\033[0m"; done
PUSH_TAGS ?= ${VERSION},latest
docker-push:
@IFS=","; tags=${PUSH_TAGS}; for tag in $${tags}; do docker push ${IMG_PREFIX}-collector:$${tag}; echo "\033[36mPushed $(IMG_PREFIX)-collector:$${tag}\033[0m"; done
@IFS=","; tags=${PUSH_TAGS}; for tag in $${tags}; do docker push ${IMG_PREFIX}-visualizer:$${tag}; echo "\033[36mPushed $(IMG_PREFIX)-visualizer:$${tag}\033[0m"; done
@IFS=","; tags=${PUSH_TAGS}; for tag in $${tags}; do docker push ${IMG_PREFIX}-docs:$${tag}; echo "\033[36mPushed $(IMG_PREFIX)-docs:$${tag}\033[0m"; done
clean:
rm -f $(COLLECTOR) $(VISUALIZER)
cd pkg/visualizer; $(PACKR2) clean
distclean: clean
rm -f ./env
.PHONY: all clean distclean fmt vet lint docker-build docker-tag docker-push generate