forked from jippi/hashi-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
70 lines (60 loc) · 1.89 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
VETARGS?=-all
EXTERNAL_TOOLS=\
github.com/kardianos/govendor \
github.com/jteeuwen/go-bindata/... \
github.com/elazarl/go-bindata-assetfs/...
GOFILES_NOVENDOR = $(shell find . -type f -name '*.go' -not -path "./backend/vendor/*")
.PHONY: bootstrap
bootstrap:
@for tool in $(EXTERNAL_TOOLS); do \
echo "Installing $$tool" ; \
go get $$tool; \
done
.PHONY: fmt
fmt:
@echo "--> Running go fmt" ;
@if [ -n "`go fmt ${GOFILES_NOVENDOR}`" ]; then \
echo "[ERR] go fmt updated formatting. Please commit formatted code first."; \
exit 1; \
fi
.PHONY: vet
vet: fmt
@go tool vet 2>/dev/null ; if [ $$? -eq 3 ]; then \
go get golang.org/x/tools/cmd/vet; \
fi
@echo "--> Running go tool vet $(VETARGS) ${GOFILES_NOVENDOR}"
@go tool vet $(VETARGS) ${GOFILES_NOVENDOR} ; if [ $$? -eq 1 ]; then \
echo ""; \
echo "[LINT] Vet found suspicious constructs. Please check the reported constructs"; \
echo "and fix them if necessary before submitting the code for review."; \
fi
.PHONY: frontend
frontend:
@echo "=> building frontend ..."
$(MAKE) -C frontend build
.PHONY: backend/bindata_assetfs.go
backend/bindata_assetfs.go: frontend
@echo "=> packaging assets ..."
go-bindata-assetfs -prefix frontend frontend/build/...
mv -f bindata_assetfs.go backend/
.PHONY: build
build: fmt vet bootstrap frontend backend/bindata_assetfs.go
$(MAKE) -C backend build
.PHONY: rebuild
rebuild:
rm -f backend/bindata_assetfs.go
rm -f backend/build/nomad-ui-darwin-amd64
$(MAKE) -j build
.PHONY: clean
clean:
@echo "=> cleaning ..."
$(MAKE) -C backend clean
$(MAKE) -C frontend clean
rm -f backend/bindata_assetfs.go
.PHONY: docker
docker:
@echo "=> build and push Docker image ..."
@docker login -e $(DOCKER_EMAIL) -u $(DOCKER_USER) -p $(DOCKER_PASS)
docker build -f Dockerfile -t iverberk/nomad-ui:$(COMMIT) .
docker tag iverberk/nomad-ui:$(COMMIT) iverberk/nomad-ui:$(TAG)
docker push iverberk/nomad-ui:$(TAG)