-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
136 lines (109 loc) · 3.07 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# 运行测试用例
test:
go test -race ./..
echo:
echo "hello from makefile"
linters-install:
@golangci-lint --version >/dev/null 2>&1 || { \
echo "installing linting tools..."; \
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s v1.41.1; \
}
lint: linters-install
golangci-lint run
# 格式化项目代码
fmt:
goimports -l -w .
# 整理项目依赖
tidy:
go mod tidy
# 构建所有服务 - 基于docker-compose
all:
sudo -E docker-compose build
sudo -E docker-compose push
# 构建access-rpc
access-rpc:
sudo -E docker-compose build access-rpc
sudo -E docker-compose push access-rpc
# 构建access-api:
access-api:
sudo -E docker-compose build access-api
sudo -E docker-compose push access-api
# 构建users-rpc:
users-rpc:
sudo -E docker-compose build users-rpc
sudo -E docker-compose push users-rpc
# 构建users-api:
users-api:
sudo -E docker-compose build users-api
sudo -E docker-compose push users-api
# 构建admin-api:
admin-api:
sudo -E docker-compose build -admin-api
sudo -E docker-compose push -admin-api
# 构建server-api:
server-api:
sudo -E docker-compose build server-api
sudo -E docker-compose push server-api
# 构建audit-api:
audit-api:
sudo -E docker-compose build audit-api
sudo -E docker-compose push audit-api
# 构建task-api:
task-api:
sudo -E docker-compose build task-api
sudo -E docker-compose push task-api
# 重启所有服务 - 基于docker-compose
all-start:
sudo -E docker-compose down
sudo -E docker-compose pull
sudo -E docker-compose up -d
# 重启access-rpc:
access-rpc-start:
sudo -E docker-compose stop access-rpc
sudo -E docker-compose pull access-rpc
sudo -E docker-compose up -d access-rpc
# 重启access-api:
access-api-start:
sudo -E docker-compose stop access-api
sudo -E docker-compose pull access-api
sudo -E docker-compose up -d access-api
# 重启users-rpc:
users-rpc-start:
sudo -E docker-compose stop users-rpc
sudo -E docker-compose pull users-rpc
sudo -E docker-compose up -d users-rpc
# 重启users-api:
users-api-start:
sudo -E docker-compose stop users-api
sudo -E docker-compose pull users-api
sudo -E docker-compose up -d users-api
# 重启admin-api:
admin-api-start:
sudo -E docker-compose stop admin-api
sudo -E docker-compose pull admin-api
sudo -E docker-compose up -d admin-api
# 重启 server-api:
server-api-start:
sudo -E docker-compose stop server-api
sudo -E docker-compose pull server-api
sudo -E docker-compose up -d server-api
# 重启audit-api:
audit-api-start:
sudo -E docker-compose stop audit-api
sudo -E docker-compose pull audit-api
sudo -E docker-compose up -d audit-api
# 重启task-api:
task-api-start:
sudo -E docker-compose stop task-api
sudo -E docker-compose pull task-api
sudo -E docker-compose up -d task-api
# 清理docker,释放无用空间
clean-docker:
sudo -E docker container prune -f
sudo -E docker image prune -f
env:
echo DOCKER_TAG="${DOCKER_TAG}" >> .env
echo PROJECT="${PROJECT}" >> .env
echo HUB_DOMAIN="${HUB_DOMAIN}" >> .env
echo BRANCH_ENV="${BRANCH_ENV}" >> .env
.PHONY: test echo