-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
36 lines (31 loc) · 819 Bytes
/
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
.PHONY: test run clean
# use the new docker compose command if available or the legacy docker-compose command
DOCKER_COMPOSE := $(shell \
docker compose version > /dev/null 2>&1; \
if [ $$? -eq 0 ]; then \
echo "docker compose"; \
else \
docker-compose version > /dev/null 2>&1; \
if [ $$? -eq 0 ]; then \
echo "docker-compose"; \
fi; \
fi; \
)
# Check if GPU is available
GPU_AVAILABLE := $(shell \
if command -v nvidia-smi > /dev/null 2>&1; then \
if [ $$(nvidia-smi -L | wc -l) -gt 0 ]; then \
echo "gpu"; \
else \
echo "no-gpu"; \
fi; \
else \
echo "no-gpu"; \
fi; \
)
run:
$(DOCKER_COMPOSE) --profile $(GPU_AVAILABLE) up --build
build:
$(DOCKER_COMPOSE) build
clean:
rm -rf dist