forked from inhere/go-web-skeleton
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
79 lines (61 loc) · 2.22 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
73
74
75
76
77
78
79
#SHELL = /bin/sh
.DEFAULT_GOAL := help
# 每行命令之前必须有一个tab键。如果想用其他键,可以用内置变量.RECIPEPREFIX 声明
# mac 下这条声明 没起作用 !!
.RECIPEPREFIX = >
.PHONY: all usage help clean
# 需要注意的是,每行命令在一个单独的shell中执行。这些Shell之间没有继承关系。
# - 解决办法是将两行命令写在一行,中间用分号分隔。
# - 或者在换行符前加反斜杠转义 \
##There some make command for the project
##
help:
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//' | sed -e 's/: / /'
##Available Commands:
all: ## Run all the commands for the entire publishing process
all: route apidoc phar pbimg
clean: ## Clean all created artifacts
clean:
git clean --exclude=.idea/ -fdx
apidoc: ## Generate swagger UI document json
apidoc:
swag init -s static
rm docs/docs.go
pack: ## Build and package the application
pack:
# collect git info to current env config file.
go build -o ./go-web-skeleton
pbprod: ## Build prod docker image and push to your hub
pbprod:
go build ./cli/cliapp.go && ./cliapp git
docker build -f Dockerfile -t your.dockerhub.com/go-web-skeleton --build-arg app_env=prod .
docker push your.dockerhub.com/go-web-skeleton
pbtest: ## Build test docker image and push to your hub
pbtest:
go build ./cli/cliapp.go && ./cliapp git
docker build -f Dockerfile -t your.dockerhub.com/go-web-skeleton:test --build-arg app_env=test .
docker push your.dockerhub.com/go-web-skeleton:test
pbaudit: ## Build audit docker image and push to your hub
pbaudit:
go build ./cli/cliapp.go && ./cliapp git
docker build -f Dockerfile -t your.dockerhub.com/go-web-skeleton:audit --build-arg app_env=audit .
docker push your.dockerhub.com/go-web-skeleton:audit
devimg: ## Build dev docker image
devimg:
docker build -f Dockerfile --build-arg app_env=dev -t go-web-skeleton:dev .
##
##Helper Commands:
test: ## Run all the tests
test: fmt lt
echo: ## echo test
echo:
echo hello
fmt: ## Run the go fmt
fmt:
go fmt ./...
lt: ## Run the golint tool
lt:
go lint ./...
tc: ## Run the unit tests with code coverage
tc:
go test -cover ./...