forked from naterini/docker-scale-out
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
53 lines (39 loc) · 1.43 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
HOST ?= mgmtnode
BUILD ?= up --build --remove-orphans -d
DC ?= $(shell docker compose version 2>&1 >/dev/null && echo "docker compose" || echo "docker-compose")
IMAGES := $(shell $(DC) config | awk '{if ($$1 == "image:") print $$2;}' | sort | uniq)
SUBNET ?= 10.11
SUBNET6 ?= 2001:db8:1:1::
.EXPORT_ALL_VARIABLES:
default: ./docker-compose.yml run
./docker-compose.yml: buildout.sh
bash buildout.sh > ./docker-compose.yml
build: ./docker-compose.yml
env BUILDKIT_PROGRESS=plain COMPOSE_HTTP_TIMEOUT=3000 $(DC) $(BUILD)
stop:
$(DC) down
set_nocache:
$(eval BUILD := build --no-cache)
nocache: set_nocache build
clean:
test -f ./docker-compose.yml && ($(DC) kill -s SIGKILL; $(DC) down --remove-orphans -t1 -v; unlink ./docker-compose.yml) || true
[ -f cloud_socket ] && unlink cloud_socket || true
uninstall:
$(DC) down --rmi all --remove-orphans -t1 -v
$(DC) rm -v
run: ./docker-compose.yml
$(DC) up --remove-orphans -d
cloud:
test -f cloud_socket && unlink cloud_socket || true
touch cloud_socket
test -f ./docker-compose.yml && unlink ./docker-compose.yml || true
env CLOUD=1 bash buildout.sh > ./docker-compose.yml
python3 cloud_monitor.py3 $(DC) up --build --remove-orphans --scale cloud=0 -d
test -f ./docker-compose.yml && unlink ./docker-compose.yml || true
test -f cloud_socket && unlink cloud_socket || true
bash:
$(DC) exec $(HOST) /bin/bash
save: build
docker save -o scaleout.tar $(IMAGES)
load:
docker load -i scaleout.tar