Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
59 lines (46 loc) · 1.52 KB
/
Copy pathMakefile
File metadata and controls
59 lines (46 loc) · 1.52 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
# === Makefile Helper ===
# Styles
YELLOW=$(shell echo "\033[00;33m")
RED=$(shell echo "\033[00;31m")
RESTORE=$(shell echo "\033[0m")
# Variables
PACKAGE_MANAGER := pnpm
DOCKER_COMPOSE = docker-compose
DEPENDENCIES := node pnpm git docker caddy
.DEFAULT_GOAL := list
CADDY_PID_FILE := caddy.dev.pid
CADDY = caddy
.PHONY: list
list:
@echo "******************************"
@echo "${YELLOW}Available targets${RESTORE}:"
@grep -E '^[a-zA-Z-]+:.*?## .*$$' Makefile | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " ${YELLOW}%-15s${RESTORE} > %s\n", $$1, $$2}'
@echo "${RED}==============================${RESTORE}"
.PHONY: check-dependencies
check-dependencies:
@for dependency in $(DEPENDENCIES); do \
if ! command -v $$dependency &> /dev/null; then \
echo "${RED}Error:${RESTORE} ${YELLOW}$$dependency${RESTORE} is not installed."; \
exit 1; \
fi; \
done
@echo "All ${YELLOW}dependencies are installed.${RESTORE}"
.PHONY: install
install: check-dependencies update ## Install the Application and reset the database
.PHONY: update
update: check-dependencies ## Update the Repo
@$(PACKAGE_MANAGER) install
.PHONY: start-services
start-services: stop-services ## Start Services
@touch $(CADDY_PID_FILE)
@$(CADDY) start --pidfile $(CADDY_PID_FILE)
.PHONY: stop-services
stop-services: ## Stop Services
-@$(CADDY) stop > /dev/null 2>&1 &
-@if [ -f $(CADDY_PID_FILE) ]; then \
kill -9 `cat $(CADDY_PID_FILE)`; \
rm -f $(CADDY_PID_FILE); \
fi
.PHONY: serve
serve: ## Serve the application
@$(PACKAGE_MANAGER) run dev --host