-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
54 lines (43 loc) · 1020 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
43
44
45
46
47
48
49
50
51
52
53
54
NAME = yasuser
VERSION := $(shell cat VERSION)
COMMITID := $(shell git rev-parse --short HEAD)
BUILDAT := $(shell date +%Y-%m-%d)
CTIMEVAR = -X main.CommitID=$(COMMITID) \
-X main.Version=$(VERSION) \
-X main.BuildAt=$(BUILDAT)
GO_LDFLAGS = -ldflags "-w $(CTIMEVAR) -s"
.PHONY: build
build:
go build -tags "$(BUILDTAGS)" $(GO_LDFLAGS) -o $(NAME) .
.PHONY: test
test:
go test -v --cover ./...
.PHONY: dev
dev: asset build
rm -f $(NAME).db
YASUSER_DEBUG=true YASUSER_SERVER_PPROF=true ./$(NAME)
.PHONY: pprof
pprof: asset build
rm -f $(NAME).db
YASUSER_SERVER_PPROF=true ./$(NAME)
.PHONY: img
img:
docker build \
-t wrfly/$(NAME):$(VERSION) \
-t wrfly/$(NAME) \
-t wrfly/$(NAME):develop .
.PHONY: push-img
push-img:
docker push wrfly/$(NAME)
docker push wrfly/$(NAME):$(VERSION)
.PHONY: push-dev-img
push-dev-img:
docker push wrfly/$(NAME):develop
.PHONY: tools
tools:
go get github.com/wrfly/bindata
.PHONY: asset
asset:
bindata -pkg asset \
-src html \
-dest routes/asset