-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathMakefile
175 lines (157 loc) · 5.61 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
.DEFAULT_GOAL := $(HELP)
BUILD = build
RUN = run
RUN_IT = run-it
BENCHMARK = benchmark
CLEAN = clean
COMPILE_REQUIREMENTS = compile-requirements
DEV = dev
LIST_TOOLS = list-tools
LIST_MODELS = list-models
LIST_PROJECTS = list-projects
CLEANUP = cleanup
HELP = help
help:
@echo "Usage:"
@echo " make $(RUN_IT) PROJECT_NAME=<your_project_name>"
@echo " make $(RUN) PROJECT_NAME=<your_project_name> PARAMS=\"<key1=value1 key2=value2>\""
@echo " make $(BENCHMARK) PROJECT_NAME=<your_project_name>"
@echo " make $(BUILD)"
@echo " make $(CLEAN)"
@echo " make $(COMPILE_REQUIREMENTS)"
@echo " make $(DEV)"
@echo " make $(LIST_TOOLS)"
@echo " make $(LIST_MODELS)"
@echo " make $(LIST_PROJECTS)"
@echo " make $(CLEANUP)"
@echo " make $(HELP)"
@echo
@echo "Available targets:"
@echo " $(RUN_IT) - Runs a project in Interactive mode (requires PROJECT_NAME)"
@echo " $(RUN) - Runs a project in CLI mode (requires PROJECT_NAME and PARAMS)"
@echo " $(BENCHMARK) - Run a project in benchmark mode (requires PROJECT_NAME)"
@echo " $(BUILD) - Build the Docker image"
@echo " $(CLEAN) - Clean up generated files"
@echo " $(COMPILE_REQUIREMENTS) - Recompile the requirements files"
@echo " $(DEV) - Install development requirements and generate LICENSES.md"
@echo " $(LIST_TOOLS) - List available tools"
@echo " $(LIST_MODELS) - List available LLM and Embedder models"
@echo " $(LIST_PROJECTS) - List available projects"
@echo " $(CLEANUP) - Perform Docker cleanup"
@echo " $(HELP) - Show this help message"
@echo
@echo "For license details, see the LICENSE file."
it: $(COMPILE_REQUIREMENTS) $(BUILD) $(RUN_IT)
$(CLEANUP):
@docker container prune
@docker image prune
@docker builder prune
$(LIST_TOOLS):
@docker run \
-it \
--env-file .env \
-v $(PWD)/config:/app/config \
-v $(PWD)/db:/app/db \
-v $(PWD)/tools:/app/tools \
-v $(PWD)/projects/$(PROJECT_NAME):/app/projects/$(PROJECT_NAME) \
-v $(PWD)/projects/$(PROJECT_NAME)/output:/app/projects/$(PROJECT_NAME)/output \
crews_control --list-tools
$(LIST_MODELS):
@docker run \
-it \
--env-file .env \
-v $(PWD)/config:/app/config \
-v $(PWD)/db:/app/db \
-v $(PWD)/tools:/app/tools \
-v $(PWD)/projects/$(PROJECT_NAME):/app/projects/$(PROJECT_NAME) \
-v $(PWD)/projects/$(PROJECT_NAME)/output:/app/projects/$(PROJECT_NAME)/output \
crews_control --list-models
$(LIST_PROJECTS):
@docker run \
-it \
--env-file .env \
-v $(PWD)/config:/app/config \
-v $(PWD)/db:/app/db \
-v $(PWD)/tools:/app/tools \
-v $(PWD)/projects/$(PROJECT_NAME):/app/projects/$(PROJECT_NAME) \
-v $(PWD)/projects/$(PROJECT_NAME)/output:/app/projects/$(PROJECT_NAME)/output \
crews_control --list-projects
$(DEV):
@pip install -r requirements-dev.txt
@pip-licenses -a -f markdown --output LICENSES.md
$(COMPILE_REQUIREMENTS):
@pip install pip-tools
@pip-compile --generate-hashes requirements-dev.in
@pip-compile --generate-hashes requirements.in
$(BUILD):
@mkdir -p db
@pip install --upgrade pip
@pip install --upgrade setuptools
@docker build . -t crews_control --build-arg CACHEBUSTER=$$(date +%s)
$(RUN_IT):
@if [ -z "$(PROJECT_NAME)" ]; then \
echo "Error: PROJECT_NAME is not set."; \
echo "Usage:"; \
echo " make $(RUN_IT) PROJECT_NAME=<your_project_name>"; \
echo "or"; \
echo " export PROJECT_NAME=<your_project_name>"; \
echo " make $(RUN_IT)"; \
exit 1; \
fi
@mkdir -p $(PWD)/projects/$(PROJECT_NAME)/output
@docker run \
-it \
--env-file .env \
-v $(PWD)/config:/app/config \
-v $(PWD)/db:/app/db \
-v $(PWD)/tools:/app/tools \
-v $(PWD)/projects/$(PROJECT_NAME):/app/projects/$(PROJECT_NAME) \
-v $(PWD)/projects/$(PROJECT_NAME)/output:/app/projects/$(PROJECT_NAME)/output \
crews_control \
--project-name $(PROJECT_NAME)
$(RUN):
@if [ -z "$(PROJECT_NAME)" ]; then \
echo "Error: PROJECT_NAME is not set."; \
echo "Usage:"; \
echo " make $(RUN) PROJECT_NAME=<your_project_name> PARAMS=\"<key1=value1 key2=value2>\""; \
echo "or"; \
echo " export PROJECT_NAME=<your_project_name>"; \
echo " export PARAMS=\"<key1=value1 key2=value2>\""; \
echo " make $(RUN)"; \
exit 1; \
fi
@if [ -z "$(PARAMS)" ]; then \
echo "Error: PARAMS is not set."; \
echo "Usage:"; \
echo " make $(RUN) PROJECT_NAME=<your_project_name> PARAMS=\"<key1=value1 key2=value2>\""; \
echo "or"; \
echo " export PROJECT_NAME=<your_project_name>"; \
echo " export PARAMS=\"<key1=value1 key2=value2>\""; \
echo " make $(RUN)"; \
exit 1; \
fi
@mkdir -p $(PWD)/projects/$(PROJECT_NAME)/output
@docker run \
--env-file .env \
-v $(PWD)/config:/app/config \
-v $(PWD)/db:/app/db \
-v $(PWD)/tools:/app/tools \
-v $(PWD)/projects/$(PROJECT_NAME):/app/projects/$(PROJECT_NAME) \
-v $(PWD)/projects/$(PROJECT_NAME)/output:/app/projects/$(PROJECT_NAME)/output \
crews_control \
--project-name $(PROJECT_NAME) --params $(PARAMS)
$(BENCHMARK):
@docker run \
-it \
--env-file .env \
-v $(PWD)/config:/app/config \
-v $(PWD)/db:/app/db \
-v $(PWD)/projects/$(PROJECT_NAME):/app/projects/$(PROJECT_NAME) \
-v $(PWD)/projects/$(PROJECT_NAME)/output:/app/projects/$(project_name)/output \
-v $(PWD)/projects/$(PROJECT_NAME)/validations:/app/projects/$(PROJECT_NAME)/validations \
crews_control \
--benchmark $(IGNORE_CACHE) --project-name $(PROJECT_NAME)
$(CLEAN):
@rm -rf output
@rm -rf db
.PHONY: it $(CLEANUP) $(DEV) $(LIST_TOOLS) $(LIST_MODELS) $(LIST_PROJECTS) $(BUILD) $(RUN) $(RUN_IT) $(CLEAN) $(BENCHMARK) $(COMPILE_REQUIREMENTS)