-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
114 lines (92 loc) · 2.32 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
NODE_MODULES := ./node_modules
APP_NAME := Thread Puller
DB_CONTAINER := redis
WEB_CONTAINER := web
BUILD_OUTPUT_DIR := .nuxt.tmp
FINAL_OUTPUT_DIR := .nuxt
GOTIFY_APP_TOKEN := AZ-fRl7Zby4aID6
.PHONY: stop
stop:
docker/compose stop
.PHONY: start
start:
docker/compose start
.PHONY: up
up:
docker/compose up -d
.PHONY: up-db
up-db:
docker/compose up -d $(DB_CONTAINER)
.PHONY: prod
prod: notify-start build reboot notify-end
.PHONY: dev
dev: $(NODE_MODULES) up-db
docker/yarn dev || exit 0
$(MAKE) down
.PHONY: debug/api
debug/api: $(NODE_MODULES)
nodemon \
--ext 'js,mjs,json,ts' \
--exec "TS_NODE_COMPILER_OPTIONS='{\"module\":\"CommonJS\",\"target\":\"ES2017\"}' node --inspect -r ts-node/register ./api"
.PHONY: down
down:
docker/compose down
lint:
ifdef fix
docker/yarn lint --fix
else
docker/yarn lint
endif
.PHONY: restart
restart: stop start
.PHONY: restart-web
restart-web:
docker/compose restart $(WEB_CONTAINER)
.PHONY: reboot
reboot: down up
.PHONY: rebuild
rebuild: build restart
.PHONY: install
install: clean yarn-install
.PHONY: notify-start
notify-start:
@curl \
"https://gotify.josip.igr.ec/message?token=$(GOTIFY_APP_TOKEN)" \
-F "title=[$(APP_NAME)] Build počeo" \
-F "message=Build za $(APP_NAME) je započeo na \`$(shell hostname)'" \
-F "priority=5" &>/dev/null \
|| exit 0
.PHONY: notify-end
notify-end:
@curl \
"https://gotify.josip.igr.ec/message?token=$(GOTIFY_APP_TOKEN)" \
-F "title=[$(APP_NAME)] Build završio" \
-F "message=Build za $(APP_NAME) je završio na \`$(shell hostname)'" \
-F "priority=5" &>/dev/null \
|| exit 0
.PHONY: notify-failed
notify-failed:
@curl \
"https://gotify.josip.igr.ec/message?token=$(GOTIFY_APP_TOKEN)" \
-F "title=[$(APP_NAME)] Build pukao" \
-F "message=Build za $(APP_NAME) je pukao na \`$(shell hostname)'" \
-F "priority=10" &>/dev/null \
|| exit 0
.PHONY: yarn-install
yarn-install:
docker/yarn install
.PHONY: build
build: yarn-install
mkdir -p "$(FINAL_OUTPUT_DIR)" && \
docker/yarn build -c nuxt.config.build && \
mv "$(FINAL_OUTPUT_DIR)" "$(FINAL_OUTPUT_DIR).old" && \
mv "$(BUILD_OUTPUT_DIR)" "$(FINAL_OUTPUT_DIR)" && \
rm -rf "$(FINAL_OUTPUT_DIR).old" \
|| $(MAKE) notify-failed
.PHONY: clean
clean:
rm -rf $(NODE_MODULES) .nuxt
.PHONY: build-containers
build-containers:
docker/compose build
$(NODE_MODULES): yarn-install