-
Notifications
You must be signed in to change notification settings - Fork 19
/
Makefile
93 lines (77 loc) · 3.22 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
.PHONY= build_server build_screenshot build_frontend run_local run_test stop test_run db
.DEFAULT_GOAL := default
CERT_FILE = ./server/src/main/resources/app.key
ENV?=dev
default:
$(MAKE) build_server & PID1=$$!; \
$(MAKE) build_screenshot & PID2=$$!; \
$(MAKE) build_frontend & PID3=$$!; \
wait $$PID1 $$PID2 $$PID3; \
echo 'DONE!'
build_server:
ifeq ( ,$(wildcard $(CERT_FILE)))
@echo ">Creating certificates"
cd ./server/scripts && ./createServerKeys.sh
endif
cd ./server && ./gradlew clean build
docker build -t ghcr.io/r-sandor/findfirst-server -f ./docker/server/Dockerfile.buildlocal ./server
build_screenshot:
cd ./screenshot && ./gradlew clean build
docker build -t ghcr.io/r-sandor/findfirst-screenshot -f ./docker/screenshot/Dockerfile.buildlocal ./screenshot
build_frontend:
docker build -t ghcr.io/r-sandor/findfirst-frontend -f ./docker/frontend/Dockerfile --build-arg BUILDENV=$(ENV) ./frontend
run:
docker compose up
run_local:
@echo ">Running frontend and server locally."
@echo ">>Stop all compose services"
docker compose down
ifeq ( ,$(wildcard $(CERT_FILE)))
@echo ">Creating certificates"
cd ./server/scripts && ./createServerKeys.sh
endif
@echo ">>>>>>> Mailhog container starting:"
@echo "=============================================================================="
docker compose up mail -d
@echo ">>>>>>> Frontend"
@echo "=============================================================================="
cd frontend && pnpm install
@echo ">> Starting Frontend"
cd frontend && pnpm run dev > frontend.log 2>&1 & echo "$$!" > frontend.pid
@echo "==============================================================================\n"
@echo ">>>>>>> Backend"
@echo "=============================================================================="
@echo ">> Building and running backend"
cd server && nohup ./gradlew bootrun > application.log 2>&1 & echo "$$!" > backend.pid
@echo "==============================================================================\n"
@echo ">>>>>>> Screenshot"
@echo "=============================================================================="
@echo ">> Building and running screenshot"
cd screenshot && nohup ./gradlew bootrun > application.log 2>&1 & echo "$$!" > screenshot.pid
@echo "==============================================================================\n"
@echo "=============================================================================="
@echo "WELCOME: navigate to localhost:3000"
@echo "==============================================================================\n"
@echo "User: jsmith"
@echo "Password: test\n"
@echo "==============================================================================\n"
clean:
cd server; ./gradlew clean;
cd screenshot; ./gradlew clean;
cd client; pnpm install --frozen-lockfile;
stop:
@echo "Stopping all started processes on host."
docker compose down --remove-orphans
ifneq (,$(wildcard backend.pid))
kill $(file < backend.pid)
rm -f backend.pid
endif
ifneq (,$(wildcard screenshot.pid))
kill $(file < screenshot.pid)
rm -f screenshot.pid
endif
@-kill -9 $$(pgrep node) $$(pgrep "next-server") $$(pgrep -f "next dev")
ifneq (,$(wildcard frontend.pid))
kill $(file < frontend.pid)
rm -f frontend.pid
endif