-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
213 lines (150 loc) · 5.29 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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
# ------------------------------------------------------------------------------
# IMPORTANT NOTE:
# This file requires tabs to work properly, do not substitute them with spaces.
# ------------------------------------------------------------------------------
SHELL := /bin/bash
prepare:
./_scripts/secrets.sh && \
docker-compose pull db nginx smtp redis
build: build-backend build-frontend build-mobile
serve: serve-backend serve-frontend serve-mobile
lint:
pre-commit run --all-files
test: test-backend test-frontend test-mobile
docs: docs-backend docs-frontend docs-mobile
check-deps: check-deps-backend check-deps-frontend check-deps-mobile
purge: purge-backend purge-frontend purge-mobile
down:
docker-compose down
# ------------------------------------------------------------------------------
# Backend
# ------------------------------------------------------------------------------
init-backend: purge-backend build-backend
build-backend:
docker-compose build backend
serve-backend:
docker-compose up backend
test-backend:
docker-compose up -d db && \
docker-compose run --rm --no-deps backend test
docs-backend:
docker-compose run --rm --no-deps backend gen_docs
shell-backend:
docker-compose run --rm --no-deps backend sh
py-shell-backend:
docker-compose run --rm --no-deps backend manage shell
db-shell-backend:
docker-compose up -d db && \
docker-compose run --rm --no-deps backend manage dbshell
db-prepare-backend:
docker-compose up -d db && \
docker-compose run --rm --no-deps backend manage makemigrations
db-migrate-backend:
docker-compose up -d db && \
docker-compose run --rm --no-deps backend manage migrate
check-deps-backend:
docker-compose run --rm --no-deps backend eval pip list --outdated
purge-backend:
docker-compose down -v
# ------------------------------------------------------------------------------
# Frontend (with node)
# ------------------------------------------------------------------------------
init-frontend: purge-frontend build-frontend
build-frontend:
pushd frontend && \
npm install && \
popd
serve-frontend:
pushd frontend && \
npm run start-dev
test-frontend:
pushd frontend && \
CI=true npm run test && \
popd
docs-frontend:
pushd frontend && \
npm run docs && \
popd
check-deps-frontend:
pushd frontend && \
npm outdated || true && \
popd
purge-frontend:
rm -rf frontend/node_modules frontend/build frontend/docs
# ------------------------------------------------------------------------------
# Frontend (with docker)
# ------------------------------------------------------------------------------
build-frontend-docker:
docker-compose kill frontend && \
docker-compose rm -f frontend && \
docker volume rm biskit_frontend_node_modules || true && \
docker-compose build frontend
serve-frontend-docker:
docker-compose up frontend
test-frontend-docker:
docker-compose run --rm --no-deps frontend test
docs-frontend-docker:
docker-compose run --rm --no-deps frontend eval npm run docs
shell-frontend-docker:
docker-compose run --rm --no-deps frontend sh
check-deps-frontend-docker:
docker-compose run --rm --no-deps frontend eval npm outdated || true
# ------------------------------------------------------------------------------
# Mobile
# ------------------------------------------------------------------------------
init-mobile: purge-mobile build-mobile
build-mobile:
pushd mobile && \
npm install && \
popd
build-mobile-apk: build-mobile
pushd mobile/android && \
./gradlew assembleRelease && \
popd
serve-mobile:
pushd mobile && \
npm run android && \
npm run start
test-mobile:
pushd mobile && \
CI=true npm run test && \
popd
docs-mobile:
pushd mobile && \
npm run docs && \
popd
check-deps-mobile:
pushd mobile && \
npm outdated || true && \
popd
purge-mobile:
rm -rf mobile/node_modules mobile/build mobile/docs mobile/android/build mobile/android/.gradle
# ------------------------------------------------------------------------------
# Production
# ------------------------------------------------------------------------------
build-prod:
docker-compose -f docker-compose.production.yml pull db nginx redis && \
docker-compose -f docker-compose.production.yml build backend frontend
serve-prod:
docker-compose -f docker-compose.production.yml up backend rq frontend
restart-prod:
docker-compose -f docker-compose.production.yml down && \
docker-compose -f docker-compose.production.yml up -d backend rq frontend
down-prod:
docker-compose -f docker-compose.production.yml down
shell-prod-front:
docker-compose -f docker-compose.production.yml run --rm --no-deps frontend sh
shell-prod-back:
docker-compose -f docker-compose.production.yml run --rm --no-deps backend sh
py-shell-prod:
docker-compose -f docker-compose.production.yml run --rm --no-deps backend manage shell
db-shell-prod:
docker-compose -f docker-compose.production.yml up -d db && \
docker-compose -f docker-compose.production.yml run --rm --no-deps backend manage dbshell
db-migrate-prod:
docker-compose -f docker-compose.production.yml up -d db && \
docker-compose -f docker-compose.production.yml run --rm --no-deps backend manage migrate
logs-prod:
docker-compose -f docker-compose.production.yml logs frontend && \
docker-compose -f docker-compose.production.yml logs backend && \
docker-compose -f docker-compose.production.yml logs rq