-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
96 lines (80 loc) · 2.53 KB
/
Copy pathMakefile
File metadata and controls
96 lines (80 loc) · 2.53 KB
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
.SILENT:
PROJECT = node-red-sentry-node
DOCKER_COMPOSE_OPTIONS = -p $(PROJECT) -f docker-compose.yml
DOCKER_COMPOSE_BASE_COMMAND = CURRENT_UID="$$(id -u):$$(id -g)" docker-compose $(DOCKER_COMPOSE_OPTIONS)
DOCKER_COMPOSE_EXEC_COMMAND = $(DOCKER_COMPOSE_BASE_COMMAND) exec
DOCKER_COMPOSE_RUN_COMMAND = $(DOCKER_COMPOSE_BASE_COMMAND) run --rm
DOCKER_COMPOSE_ISOLATED_RUN_COMMAND = $(DOCKER_COMPOSE_BASE_COMMAND) run --rm --no-deps
CONSOLE_VERBOSITY = -v
## Install whole setup & start docker-compose environment
serve: install-locally dcbuild dcpull dcup install-in-container dcup
open http://localhost:1880
.PHONY: serve
## Install package locally
install-locally:
npm install
.PHONY: install-locally
## Install package in node-red container
install-in-container:
$(DOCKER_COMPOSE_EXEC_COMMAND) -w /data node-red npm install /repo
.PHONY: install-in-container
## Stop the whole docker-compose environment
stop: dcdown
.PHONY: stop
## Run all static code analysers and tests
test:
npm ci
npm run build --if-present
npm test
.PHONY: test
## Start docker-compose services
dcup:
$(DOCKER_COMPOSE_BASE_COMMAND) up -d --force-recreate
.PHONY: dcup
## Stop docker-compose services
dcdown:
$(DOCKER_COMPOSE_BASE_COMMAND) down --remove-orphans --volumes
.PHONY: dcdown
## Pull all docker images for current compose-project
dcpull:
$(DOCKER_COMPOSE_BASE_COMMAND) pull
.PHONY: dcpull
## Build all docker images for current compose-project
dcbuild:
COMPOSE_DOCKER_CLI_BUILD=1 \
DOCKER_BUILDKIT=1 \
$(DOCKER_COMPOSE_BASE_COMMAND) build --pull --parallel
.PHONY: dcbuild
## Show container status for current compose-project
dcps:
$(DOCKER_COMPOSE_BASE_COMMAND) ps
.PHONY: dcps
## Show docker images for current compose-project
dcimages:
$(DOCKER_COMPOSE_BASE_COMMAND) images
.PHONY: dcimages
## Show docker logs for a service in the current compose-project
dclogs:
printf "\n\e[33mService?\e[0m\n> "; \
read SERVICE; \
$(DOCKER_COMPOSE_BASE_COMMAND) logs -f "$$SERVICE"
.PHONY: dclogs
## Log into a container of the current compose-project
dclogin:
printf "\n\e[33mService?\e[0m\n> "; \
read SERVICE; \
$(DOCKER_COMPOSE_EXEC_COMMAND) "$$SERVICE" sh
.PHONY: dclogin
## This help screen
help:
printf "Available commands\n\n"
awk '/^[a-zA-Z\-\_0-9]+:/ { \
helpMessage = match(lastLine, /^## (.*)/); \
if (helpMessage) { \
helpCommand = substr($$1, 0, index($$1, ":")-1); \
helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
printf "\033[33m%-25s\033[0m %s\n", helpCommand, helpMessage; \
} \
} \
{ lastLine = $$0 }' $(MAKEFILE_LIST)
.PHONY: help