6
6
# - In windows, only WSL is supported
7
7
#
8
8
# by sanderegg, pcrespov
9
+ #
9
10
.DEFAULT_GOAL := help
10
- SHELL := /bin/bash
11
11
12
+ SHELL := /bin/bash
12
13
13
- # TOOLS --------------------------------------
14
14
15
15
MAKE_C := $(MAKE ) --no-print-directory --directory
16
16
@@ -60,7 +60,9 @@ export SWARM_STACK_NAME ?= simcore
60
60
export DOCKER_IMAGE_TAG ?= latest
61
61
export DOCKER_REGISTRY ?= itisfoundation
62
62
63
+
63
64
.PHONY : help
65
+
64
66
help : # # help on rule's targets
65
67
ifeq ($(IS_WIN ) ,)
66
68
@awk --posix 'BEGIN {FS = ":.*?# # "} /^[[:alpha:][:space:]_-]+:.*?## / {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
70
72
71
73
72
74
73
- # # docker BUILD -------------------------------
75
+ # # DOCKER BUILD -------------------------------
74
76
#
75
77
# - all builds are inmediatly tagged as 'local/{service}:${BUILD_TARGET}' where BUILD_TARGET='development', 'production', 'cache'
76
78
# - only production and cache images are released (i.e. tagged pushed into registry)
@@ -127,7 +129,6 @@ endif
127
129
endif
128
130
129
131
130
- # TODO: should download cache if any??
131
132
build-cache build-cache-nc build-cache-kit build-cache-x : .env # # Build cache images and tags them as 'local/{service-name}:cache'
132
133
ifeq ($(target ) ,)
133
134
# Compiling front-end
@@ -152,7 +153,7 @@ shell:
152
153
docker run -it local/$(target ) :production /bin/sh
153
154
154
155
155
- # # docker SWARM -------------------------------
156
+ # # DOCKER SWARM -------------------------------
156
157
#
157
158
# - All resolved configuration are named as .stack-${name}-*.yml to distinguish from docker-compose files which can be parametrized
158
159
#
@@ -179,6 +180,7 @@ docker-compose-configs = $(wildcard services/docker-compose*.yml)
179
180
# Creating config for ops stack to $@
180
181
@docker-compose -f services/docker-compose-ops.yml --log-level=ERROR config > $@
181
182
183
+
182
184
.PHONY : up-devel up-prod up-version up-latest .deploy-ops
183
185
184
186
.deploy-ops : .stack-ops.yml
@@ -235,7 +237,7 @@ leave: ## Forces to stop all services, networks, etc by the node leaving the swa
235
237
$(if $(SWARM_HOSTS ) ,,docker swarm init)
236
238
237
239
238
- # # docker TAGS -------------------------------
240
+ # # DOCKER TAGS -------------------------------
239
241
240
242
.PHONY : tag-local tag-cache tag-version tag-latest
241
243
@@ -263,10 +265,10 @@ tag-latest: ## Tags last locally built production images as '${DOCKER_REGISTRY}/
263
265
264
266
265
267
266
- # # docker PULL/PUSH -------------------------------
268
+ # # DOCKER PULL/PUSH -------------------------------
267
269
#
268
- # TODO: cannot push modified/untracke
269
- # TODO: cannot push discetedD
270
+ # TODO: cannot push modified/untracked
271
+ # TODO: cannot push disceted
270
272
#
271
273
.PHONY : pull-cache pull-version
272
274
pull-cache : .env
@@ -296,21 +298,7 @@ push-version: tag-version
296
298
)
297
299
298
300
299
- # # PYTHON -------------------------------
300
- .PHONY : pylint
301
-
302
- pylint : # # Runs python linter framework's wide
303
- # See exit codes and command line https://pylint.readthedocs.io/en/latest/user_guide/run.html#exit-codes
304
- # TODO: NOT windows friendly
305
- /bin/bash -c " pylint --jobs=0 --rcfile=.pylintrc $( strip $( shell find services packages -iname ' *.py' \
306
- -not -path " *egg*" \
307
- -not -path " *migration*" \
308
- -not -path " *datcore.py" \
309
- -not -path " *sandbox*" \
310
- -not -path " *-sdk/python*" \
311
- -not -path " *generated_code*" \
312
- -not -path " *datcore.py" \
313
- -not -path " *web/server*" ))"
301
+ # # ENVIRONMENT -------------------------------
314
302
315
303
.PHONY : devenv devenv-all
316
304
@@ -332,25 +320,42 @@ devenv-all: devenv ## sets up extra development tools (everything else besides p
332
320
@$(MAKE_C ) scripts/json-schema-to-openapi-schema
333
321
334
322
335
- # # MISC -------------------------------
336
-
337
- .PHONY : new-service
338
- new-service : .venv # # Bakes a new project from cookiecutter-simcore-pyservice and drops it under services/ [UNDER DEV]
339
- $< /bin/pip3 --quiet install cookiecutter
340
- .venv/bin/cookiecutter gh:itisfoundation/cookiecutter-simcore-pyservice --output-dir $(CURDIR ) /services
341
-
342
- # TODO: NOT windows friendly
343
323
.env : .env-devel # # creates .env file from defaults in .env-devel
344
324
$(if $(wildcard $@ ) , \
345
325
@echo " WARNING ##### $< is newer than $@ ####" ; diff -uN $@ $< ; false ; ,\
346
- @echo " WARNING ##### $@ does not exist, copying $< ############" ; cp $< $@ )
326
+ @echo " WARNING ##### $@ does not exist, cloning $< as $@ ############" ; cp $< $@ )
327
+
347
328
348
- # TODO: NOT windows friendly
349
329
.vscode/settings.json : .vscode-template/settings.json
350
330
$(info WARNING: ##### $< is newer than $@ ####)
351
331
@diff -uN $@ $<
352
332
@false
353
333
334
+
335
+
336
+ # # TOOLS -------------------------------
337
+
338
+ .PHONY : pylint
339
+
340
+ pylint : # # Runs python linter framework's wide
341
+ /bin/bash -c " pylint --jobs=0 --rcfile=.pylintrc $( strip $( shell find services packages -iname ' *.py' \
342
+ -not -path " *egg*" \
343
+ -not -path " *migration*" \
344
+ -not -path " *datcore.py" \
345
+ -not -path " *sandbox*" \
346
+ -not -path " *-sdk/python*" \
347
+ -not -path " *generated_code*" \
348
+ -not -path " *datcore.py" \
349
+ -not -path " *web/server*" ))"
350
+ # See exit codes and command line https://pylint.readthedocs.io/en/latest/user_guide/run.html#exit-codes
351
+
352
+
353
+ .PHONY : new-service
354
+ new-service : .venv # # Bakes a new project from cookiecutter-simcore-pyservice and drops it under services/ [UNDER DEV]
355
+ $< /bin/pip3 --quiet install cookiecutter
356
+ .venv/bin/cookiecutter gh:itisfoundation/cookiecutter-simcore-pyservice --output-dir $(CURDIR ) /services
357
+
358
+
354
359
.PHONY : openapi-specs
355
360
openapi-specs : # # bundles and validates openapi specifications and schemas of ALL service's API
356
361
@$(MAKE_C ) services/web/server $@
@@ -366,6 +371,23 @@ code-analysis: .codeclimate.yml ## runs code-climate analysis
366
371
./scripts/code-climate.bash analyze
367
372
368
373
374
+ .PHONY : auto-doc
375
+ auto-doc : .stack-simcore-version.yml # # updates diagrams for README.md
376
+ # Parsing docker-compose config $< and creating graph
377
+ @./scripts/docker-compose-viz.bash $<
378
+ # Updating docs/img
379
+ @mv --verbose $< .png docs/img/
380
+
381
+
382
+ .PHONY : postgres-upgrade
383
+ postgres-upgrade : # # initalize or upgrade postgres db to latest state
384
+ @$(MAKE_C ) packages/postgres-database/docker build
385
+ @$(MAKE_C ) packages/postgres-database/docker upgrade
386
+
387
+
388
+
389
+ # # INFO -------------------------------
390
+
369
391
.PHONY : info info-images info-swarm info-tools
370
392
info : # # displays setup information
371
393
# setup info:
@@ -388,7 +410,6 @@ info: ## displays setup information
388
410
@echo ' python : $(shell python3 --version)'
389
411
390
412
391
-
392
413
define show-meta
393
414
$(foreach iid,$(shell docker images * /$(1 ) :* -q | sort | uniq) ,\
394
415
docker image inspect $(iid ) | jq '.[0] | .RepoTags, .ContainerConfig.Labels';)
@@ -423,6 +444,9 @@ ifneq ($(SWARM_HOSTS), )
423
444
endif
424
445
425
446
447
+
448
+ # # CLEAN -------------------------------
449
+
426
450
.PHONY : clean clean-images clean-venv clean-all clean-ps
427
451
428
452
_git_clean_args := -dxf -e .vscode -e TODO.md -e .venv
@@ -460,19 +484,6 @@ clean-all: clean clean-ps clean-images # Deep clean including .venv and produced
460
484
-rm -rf .venv
461
485
462
486
463
- .PHONY : postgres-upgrade
464
- postgres-upgrade : # # initalize or upgrade postgres db to latest state
465
- @$(MAKE_C ) packages/postgres-database/docker build
466
- @$(MAKE_C ) packages/postgres-database/docker upgrade
467
-
468
-
469
487
.PHONY : reset
470
488
reset : # # restart docker daemon (LINUX ONLY)
471
489
sudo systemctl restart docker
472
-
473
- .PHONY : auto-doc
474
- auto-doc : .stack-simcore-version.yml # # updates diagrams for README.md
475
- # Parsing docker-compose config $< and creating graph
476
- @./scripts/docker-compose-viz.bash $<
477
- # Updating docs/img
478
- @mv --verbose $< .png docs/img/
0 commit comments