-
Notifications
You must be signed in to change notification settings - Fork 435
/
Copy pathMakefile
139 lines (115 loc) · 5.52 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# Available Commands:
# Commands that don't require conda environment:
# make help - Show this help message
# make setup - Run complete installation script
# make start - Start all services
# make stop - Stop chat services
# make restart - Restart chat services
# make restart-backend - Restart only backend service
# make restart-force - Force restart and reset data
# make status - Show status of all services
.PHONY: install test format lint all setup start stop restart restart-backend restart-force help check-conda check-env docker-build docker-up docker-down docker-build-backend docker-build-frontend docker-restart-backend docker-restart-frontend docker-restart-all
# Show help message
help:
@echo "\033[0;36m"
@echo ' ███████╗███████╗ ██████╗ ██████╗ ███╗ ██╗██████╗ ███╗ ███╗███████╗'
@echo ' ██╔════╝██╔════╝██╔════╝██╔═══██╗████╗ ██║██╔══██╗ ████╗ ████║██╔════╝'
@echo ' ███████╗█████╗ ██║ ██║ ██║██╔██╗ ██║██║ ██║█████╗██╔████╔██║█████╗ '
@echo ' ╚════██║██╔══╝ ██║ ██║ ██║██║╚██╗██║██║ ██║╚════╝██║╚██╔╝██║██╔══╝ '
@echo ' ███████║███████╗╚██████╗╚██████╔╝██║ ╚████║██████╔╝ ██║ ╚═╝ ██║███████╗'
@echo ' ╚══════╝╚══════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═══╝╚═════╝ ╚═╝ ╚═╝╚══════╝'
@echo "\033[0m"
@echo "\033[1mSecond-Me Makefile Commands\033[0m"
@echo "\033[0;90m$$(date)\033[0m\n"
@echo ""
@echo "\033[1;32m▶ MAIN COMMANDS:\033[0m"
@echo " make setup - Complete installation"
@echo " make start - Start all services"
@echo " make stop - Stop all services"
@echo " make restart - Restart all services"
@echo " make restart-backend - Restart only backend service"
@echo " make restart-force - Force restart and reset data"
@echo " make status - Show status of all services"
@echo ""
@echo "\033[1;32m▶ DOCKER COMMANDS:\033[0m"
@echo " make docker-build - Build all Docker images"
@echo " make docker-up - Start all Docker containers"
@echo " make docker-down - Stop all Docker containers"
@echo " make docker-build-backend - Build only backend Docker image"
@echo " make docker-build-frontend - Build only frontend Docker image"
@echo " make docker-restart-backend - Restart only backend container"
@echo " make docker-restart-frontend - Restart only frontend container"
@echo " make docker-restart-all - Restart all Docker containers"
@echo ""
@echo "\033[1mAll Available Commands:\033[0m"
@echo " make help - Show this help message"
@echo " make check-env - Check environment without installing"
@echo ""
@echo "\033[1mCommands that require conda environment:\033[0m"
@echo " make install - Install project dependencies"
@echo " make test - Run tests"
@echo " make format - Format code"
@echo " make lint - Check code style"
@echo " make all - Run format, lint and test"
# Check if in conda environment
check-conda:
@if [ -z "$$CONDA_DEFAULT_ENV" ]; then \
echo "Error: Please activate conda environment first!"; \
exit 1; \
fi
# Check environment without installing
check-env:
zsh ./scripts/setup.sh --check-only
# Commands that don't require conda environment
setup:
zsh ./scripts/setup.sh
start:
zsh ./scripts/start.sh
stop:
zsh ./scripts/stop.sh
restart:
zsh ./scripts/restart.sh
restart-backend:
zsh ./scripts/restart-backend.sh
restart-force:
zsh ./scripts/restart-force.sh
status:
zsh ./scripts/status.sh
# Docker commands
# Set Docker environment variable for all Docker commands
docker-%: export IN_DOCKER_ENV=1
docker-build:
docker-compose build
docker-up:
docker-compose up -d
docker-down:
docker-compose down
docker-build-backend:
docker-compose build backend
docker-build-frontend:
docker-compose build frontend
docker-restart-backend:
docker-compose stop backend
docker-compose rm -f backend
docker-compose build backend || { echo "\033[1;31m❌ Backend build failed! Aborting operation...\033[0m"; exit 1; }
docker-compose up -d backend
docker-restart-frontend:
docker-compose stop frontend
docker-compose rm -f frontend
docker-compose build frontend || { echo "\033[1;31m❌ Frontend build failed! Aborting operation...\033[0m"; exit 1; }
docker-compose up -d frontend
docker-restart-all:
docker-compose stop
docker-compose rm -f
docker-compose build || { echo "\033[1;31m❌ Build failed! Aborting operation...\033[0m"; exit 1; }
docker-compose up -d
# Commands that require conda environment
install: check-conda
poetry install
test: check-conda
poetry run pytest tests
format: check-conda
poetry run ruff format lpm_kernel/
lint: check-conda
poetry run ruff check lpm_kernel/
all: check-conda format lint test