This repository has been archived by the owner on Feb 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
96 lines (74 loc) · 2.58 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# link https://github.com/humbug/box/blob/master/Makefile
#SHELL = /bin/sh
.DEFAULT_GOAL := help
# 每行命令之前必须有一个tab键。如果想用其他键,可以用内置变量.RECIPEPREFIX 声明
# mac 下这条声明 没起作用 !!
.RECIPEPREFIX = >
.PHONY: all usage help clean config
# 需要注意的是,每行命令在一个单独的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 -o static
# mv static/docs.go web/api_docs.go
rm static/docs.go
# sed -i 's/package\ docs/package\ web/' web/api_docs.go
pack: ## Build and package the application
pack:
# collect git info to current env config file.
go build -o ./temp/app
pbprod: ## Build prod docker image and push to your hub
pbprod:
go build ./cmd/cliapp.go && ./cliapp git:info
docker build -f Dockerfile -t your.dockerhub.com/go-gin-skeleton --build-arg app_env=prod .
docker push your.dockerhub.com/go-gin-skeleton
pbtest: ## Build test docker image and push to your hub
pbtest:
go build ./cmd/cliapp.go && ./cliapp git:info
docker build -f Dockerfile -t your.dockerhub.com/go-gin-skeleton:test --build-arg app_env=test .
docker push your.dockerhub.com/go-gin-skeleton:test
pbaudit: ## Build audit docker image and push to your hub
pbaudit:
go build ./cmd/cliapp.go && ./cliapp git:info
docker build -f Dockerfile -t your.dockerhub.com/go-gin-skeleton:audit --build-arg app_env=audit .
docker push your.dockerhub.com/go-gin-skeleton:audit
devimg: ## Build dev docker image
devimg:
docker build -f Dockerfile --build-arg app_env=dev -t go-gin-skeleton:dev .
gitinfo: ## Generate git info
gitinfo:
go build ./cmd/cliapp.go && ./cliapp git:info
##
##Tests Commands:
test: ## Run all the tests
test: tu
echo: ## echo test
echo:
echo hello
lint: ## golint check
lint:
golint ./...
gofmt: ## gofmt check
gofmt:
gofmt -l ./
tu: ## Run the unit tests
tu:
go test
#
# Rules from files
#---------------------------------------------------------------------------
Gopkg.lock:
dep ensure
vendor: Gopkg.lock
dep init