-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
53 lines (39 loc) · 1.77 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: dpoveda- <me@izenynn.com> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2022/02/21 18:47:50 by dpoveda- #+# #+# #
# Updated: 2022/03/01 00:30:04 by dpoveda- ### ########.fr #
# #
# **************************************************************************** #
#################### VARIABLES ####################
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
ENV_FILE = ./srcs/.env.macos
else
ENV_FILE = ./srcs/.env
endif
VOLUMES_PATH = ${HOME}/data/inception_data
VOLUMES_DIR = db_data web_data
VOLUMES = $(addprefix $(VOLUMES_PATH)/, $(VOLUMES_DIR))
#################### RULES ####################
all: stop load
load: | $(VOLUMES)
docker-compose -f ./srcs/docker-compose.yml --env-file $(ENV_FILE) up -d --build
debug: | $(VOLUMES)
docker-compose -f ./srcs/docker-compose.yml --env-file $(ENV_FILE) up --build
$(VOLUMES):
mkdir -p $(VOLUMES)
stop:
docker-compose -f srcs/docker-compose.yml --env-file $(ENV_FILE) down
clean: stop
docker volume rm $(addprefix srcs_, $(VOLUMES_DIR)) -f
docker volume prune -f
rm -rf $(VOLUMES_PATH) || rm -rf $(VOLUMES)
prune: clean
docker system prune -af
re: prune load
.PHONY: all load debug stop clean prune re