forked from nucleuscloud/neosync
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
121 lines (92 loc) · 3.48 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
.PHONY: help default \
cluster/create cluster/destroy \
build build/backend build/worker build/cli build/frontend \
dbuild dbuild/backend dbuild/worker dbuild/cli \
install/frontend \
lint lint/go lint/frontend \
clean clean/backend clean/worker clean/cli \
compose/up compose/down \
compose/auth/up compose/auth/down \
compose/dev/up compose/dev/down \
compose/dev/auth/up compose/dev/auth/down
default: help
help:
@echo "Available commands:"
@awk 'BEGIN {FS = ":.*##"; printf "\n"} /^[a-zA-Z_\/]+:.*##/ { printf "\033[36m%-30s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST)
PROD_COMPOSE_FILE = compose.yml
PROD_AUTH_COMPOSE_FILE = compose.auth.yml
DEV_COMPOSE_FILE = compose.dev.yml
DEV_AUTH_COMPOSE_FILE = compose.auth.dev.yml
# Cluster Management
cluster/create: ## Creates a local K8s Cluster
sh ./tilt/scripts/cluster-create.sh
cluster/destroy: ## Destroys a local K8s Cluster
bash ./tilt/scripts/assert-context.sh
sh ./tilt/scripts/cluster-destroy.sh
# Building
build: ## Builds the project (except the frontend)
make build/backend &
make build/worker &
make build/cli &
make install/frontend &
wait
dbuild: ## Builds the project specifically for Linux
make dbuild/backend &
make dbuild/worker &
make dbuild/cli &
make install/frontend &
wait
build/backend: ## Builds the backend
@cd ./backend && make build
dbuild/backend: ## Runs the backend specifically for Linux
@cd ./backend && make dbuild
build/worker: ## Builds the worker
@cd ./worker && make build
dbuild/worker: ## Builds the worker specifically for Linux
@cd ./worker && make dbuild
build/cli: ## Builds the CLI
@cd ./cli && make build
dbuild/cli: ## Builds the CLI specifically for Linux
@cd ./cli && make dbuild
install/frontend: ## Runs npm install for the frontend
@cd ./frontend && npm install
build/frontend: ## Builds the frontend (don't do this if intending to develop locally)
@cd ./frontend && npm run build
# Linting
lint: ## Lints the project
make lint/go &
make lint/frontend &
wait
lint/go: ## Lints the Go Module
golangci-lint run
lint/frontend: ## Lints the frontend
@cd ./frontend && npm run lint
# Cleaning
clean: ## Cleans the project
make clean/backend &
make clean/worker &
make clean/cli &
wait
clean/backend: ## Cleans the backend
@cd ./backend && make clean
clean/worker: ## Cleans the worker
@cd ./worker && make clean
clean/cli: ## Cleans the CLI
@cd ./cli && make clean
# Compose Management
compose/up: ## Composes up the production environment
docker compose -f $(PROD_COMPOSE_FILE) up -d
compose/down: ## Composes down the production environment
docker compose -f $(PROD_COMPOSE_FILE) down
compose/auth/up: ## Composes up the production environment with auth
docker compose -f $(PROD_COMPOSE_FILE) -f $(PROD_AUTH_COMPOSE_FILE) up -d
compose/auth/down: ## Composes down the production environment with auth
docker compose -f $(PROD_COMPOSE_FILE) -f $(PROD_AUTH_COMPOSE_FILE) down
compose/dev/up: ## Composes up the development environment. Must run dbuild first.
docker compose -f $(DEV_COMPOSE_FILE) watch
compose/dev/down: ## Composes down the development environment
docker compose -f $(DEV_COMPOSE_FILE) down
compose/dev/auth/up: ## Composes up the development environment with auth. Must run dbuild first.
docker compose -f $(DEV_COMPOSE_FILE) -f $(DEV_AUTH_COMPOSE_FILE) watch
compose/dev/auth/down: ## Composes down the development environment with auth
docker compose -f $(DEV_COMPOSE_FILE) -f $(DEV_AUTH_COMPOSE_FILE) down