-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
59 lines (45 loc) · 1.51 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
NAME = dogs-fact
CONTAINER := $(shell docker ps --all --quiet --filter="name=$(NAME)")
#CONTAINER := $(or ${CONTAINER},${CONTAINER},NO CONTAINER. To create: make)
.PHONY: clean test run scale stop start compose rm
test:
@echo "\n### Starting unittests... ###########"
python3 -m unittest tests/test_*
@echo "Done."
#compose:
# @echo "Building compose image, please wait around 60 seconds..."
# docker-compose build --force-rm --pull --quiet
# @echo "Built."
run: #compose
@echo "Building and running compose (up)..."
docker-compose build --force-rm --pull | grep Step #--quiet
docker-compose up --remove-orphans -d
docker ps --filter="name=$(NAME)"
@echo "Ready."
scale: #compose
@echo "Building and running compose (up) with 3 instances..."
docker-compose -f docker-compose-scale.yml build --force-rm --pull | grep Step #--quiet
docker-compose -f docker-compose-scale.yml up -d --scale app=2
@echo "Ready."
start:
@echo "Starting container..."
docker container start "$(CONTAINER)"
@echo "Ready."
logs:
docker-compose logs
stop:
@echo "Stopping container..."
docker container stop $(CONTAINER)
@echo "Stopped."
rm:
@echo "Cleaning up (docker-compose)..."
docker-compose down --remove-orphans --rmi all
make clean
@echo "Done."
clean:
@echo "Cleaning up (cache and virtualenv)..."
-docker-compose down --remove-orphans --rmi all >/dev/null 2>&1
find . -type d -name '__pycache__' -exec rm -rf {} + >/dev/null 2>&1
find . -type d -name '.venv' -exec rm -rf {} + >/dev/null 2>&1
@echo "Done."
default: run