-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
93 lines (72 loc) · 3.1 KB
/
Makefile
File metadata and controls
93 lines (72 loc) · 3.1 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
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
# Makefile
# Build and run the local stack for Pyronear
help:
@echo "Targets:"
@echo " init Create .env from .env.test if missing"
@echo " build Build local images in this repo"
@echo " build-external Build images in sibling repos"
@echo " build-all Build local and external images"
@echo " run-backend Start base services only"
@echo " run-engine Start base services plus engine profile"
@echo " run-tools-and-engine Start base services plus tools and engine profiles"
@echo " run-tools Start base services plus tools profile"
@echo " run Start base services plus front and tools profiles"
@echo " stop-engine Stop only engine services (engine + pyro_camera_api)"
@echo " restart-engine Restart engine services without re-running init_script"
@echo " stop Stop and remove all services and volumes"
@echo " ps Show compose status"
@echo " logs Follow logs"
@echo " test Run pytest"
# -------------------------------------------------------------------
# Init
# -------------------------------------------------------------------
init:
@test -f .env || cp .env.test .env
# -------------------------------------------------------------------
# Build images in this repo
# -------------------------------------------------------------------
build:
docker build -f containers/init_script/Dockerfile -t pyronear/pyro-api-init:latest containers/init_script/
docker build -f containers/notebooks/Dockerfile -t pyronear/notebooks:latest containers/notebooks/
# -------------------------------------------------------------------
# Build images from sibling repositories
# -------------------------------------------------------------------
build-external:
cd ../pyro-api && make build
cd ../pyro-engine && make build-lib
cd ../pyro-engine && make build-app
build-all: build build-external
# -------------------------------------------------------------------
# Run targets
# -------------------------------------------------------------------
# Base services: db, minio, pyro_api, init_script
run-backend:
docker compose up -d
# Engine profile adds engine + pyro_camera_api
run-engine:
docker compose --profile engine up -d
# Tools + engine (tools must be up first so the API is ready when engine starts)
run-tools-and-engine:
$(MAKE) run-tools
$(MAKE) run-engine
# Tools profile adds notebooks, db-ui
run-tools:
docker compose --profile tools up -d
# Front profile adds frontend, here we also include tools
run:
docker compose --profile front --profile tools up -d
stop-engine:
docker compose --profile engine stop engine pyro_camera_api
restart-engine: stop-engine
docker compose --profile engine up -d engine pyro_camera_api --no-deps
stop:
docker compose --profile front --profile engine --profile tools down -v
ps:
docker compose ps
logs:
docker compose logs -f --tail=200
# -------------------------------------------------------------------
# Tests
# -------------------------------------------------------------------
test:
pytest -s tests/*