-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
executable file
·72 lines (62 loc) · 2.82 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: llescure <llescure@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2021/06/03 10:40:53 by llescure #+# #+# #
# Updated: 2021/08/02 10:47:36 by llescure ### ########.fr #
# #
# **************************************************************************** #
BLACK := $(shell tput -Txterm setaf 0)
RED := $(shell tput -Txterm setaf 1)
GREEN := $(shell tput -Txterm setaf 2)
YELLOW := $(shell tput -Txterm setaf 3)
LIGHTPURPLE := $(shell tput -Txterm setaf 4)
PURPLE := $(shell tput -Txterm setaf 5)
BLUE := $(shell tput -Txterm setaf 6)
WHITE := $(shell tput -Txterm setaf 7)
RESET := $(shell tput -Txterm sgr0)
COMPOSE_FILE=./srcs/docker-compose.yml
all: run
run:
@echo "$(GREEN)Building files for volumes ... $(RESET)"
@sudo mkdir -p /home/llescure/data/wordpress
@sudo mkdir -p /home/llescure/data/mysql
@echo "$(GREEN)Building containers ... $(RESET)"
@docker-compose -f $(COMPOSE_FILE) up --build
up:
@echo "$(GREEN)Building files for volumes ... $(RESET)"
@sudo mkdir -p /home/llescure/data/wordpress
@sudo mkdir -p /home/llescure/data/mysql
@echo "$(GREEN)Building containers in background ... $(RESET)"
@docker-compose -f $(COMPOSE_FILE) up -d --build
debug:
@echo "$(GREEN)Building files for volumes ... $(RESET)"
@sudo mkdir -p /home/llescure/data/wordpress
@sudo mkdir -p /home/llescure/data/mysql
@echo "$(GREEN)Building containers with log information ... $(RESET)"
@docker-compose -f $(COMPOSE_FILE) --verbose up
list:
@echo "$(PURPLE)Listing all containers ... $(RESET)"
docker ps -a
list_volumes:
@echo "$(PURPLE)Listing volumes ... $(RESET)"
docker volume ls
clean:
@echo "$(RED)Stopping containers ... $(RESET)"
@docker-compose -f $(COMPOSE_FILE) down
@-docker stop `docker ps -qa`
@-docker rm `docker ps -qa`
@echo "$(RED)Deleting all images ... $(RESET)"
@-docker rmi -f `docker images -qa`
@echo "$(RED)Deleting all volumes ... $(RESET)"
@-docker volume rm `docker volume ls -q`
@echo "$(RED)Deleting all network ... $(RESET)"
@-docker network rm `docker network ls -q`
@echo "$(RED)Deleting all data ... $(RESET)"
@sudo rm -rf /home/llescure/data/wordpress
@sudo rm -rf /home/llescure/data/mysql
@echo "$(RED)Deleting all $(RESET)"
.PHONY: run up debug list list_volumes clean