-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
85 lines (68 loc) · 2.57 KB
/
Makefile
File metadata and controls
85 lines (68 loc) · 2.57 KB
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
73
74
75
76
77
78
79
80
81
82
83
84
85
GREEN = \033[0;32m
YELLOW = \033[0;33m
BLUE = \033[0;34m
RESET = \033[0m
COMPOSE = docker compose -f ./srcs/docker-compose.yml
all: up
help:
@echo "$(BLUE)Inception Project Makefile$(RESET)"
@echo "$(YELLOW)Usage:$(RESET)"
@echo " make [target]"
@echo ""
@echo "$(YELLOW)Targets:$(RESET)"
@echo " $(GREEN)all$(RESET) - Default: builds and starts containers"
@echo " $(GREEN)up$(RESET) - Start containers in detached mode"
@echo " $(GREEN)build$(RESET) - Build or rebuild containers"
@echo " $(GREEN)down$(RESET) - Stop and remove containers"
@echo " $(GREEN)clean$(RESET) - Remove containers, volumes, and networks"
@echo " $(GREEN)fclean$(RESET) - Remove everything including images"
@echo " $(GREEN)re$(RESET) - Rebuild everything from scratch"
@echo " $(GREEN)logs$(RESET) - View container logs"
@echo " $(GREEN)ps$(RESET) - List containers"
@echo " $(GREEN)wordpress$(RESET) - Access WordPress container shell"
@echo " $(GREEN)mariadb$(RESET) - Access MariaDB container shell"
@echo " $(GREEN)nginx$(RESET) - Access Nginx container shell"
@echo ""
build:
@echo "$(GREEN)Building containers...$(RESET)"
@$(COMPOSE) build
up:
@echo "$(GREEN)Starting containers...$(RESET)"
@$(COMPOSE) up -d
restart:
@echo "$(GREEN)Restarting containers...$(RESET)"
@$(COMPOSE) restart
down:
@echo "$(GREEN)Stopping containers...$(RESET)"
@$(COMPOSE) down
clean:
@echo "$(YELLOW)Removing containers, networks, and volumes...$(RESET)"
@$(COMPOSE) down -v
fclean: clean
@echo "$(YELLOW)Removing all related Docker images...$(RESET)"
@docker rmi -f $$(docker images -q inception_* 2>/dev/null) 2>/dev/null || true
re: fclean build up
@echo "$(GREEN)Rebuilt and started everything from scratch!$(RESET)"
logs:
@echo "$(BLUE)Showing logs (press Ctrl+C to exit)...$(RESET)"
@$(COMPOSE) logs -f
ps:
@echo "$(BLUE)Listing containers...$(RESET)"
@$(COMPOSE) ps
wordpress:
@echo "$(GREEN)Accessing WordPress container...$(RESET)"
@docker exec -it wordpress sh
mariadb:
@echo "$(GREEN)Accessing MariaDB container...$(RESET)"
@docker exec -it mariadb sh
nginx:
@echo "$(GREEN)Accessing Nginx container...$(RESET)"
@docker exec -it nginx sh
wp-admin:
@echo "$(GREEN)Accessing WordPress admin...$(RESET)"
@open https://mdekker.42.fr/wp-admin || \
xdg-open https://mdekker.42.fr/wp-admin || \
start https://mdekker.42.fr/wp-admin || \
echo "If the browser does not open, please visit:" && \
echo "https://mdekker.42.fr/wp-admin"
.PHONY: all help build up down restart clean fclean re logs ps wordpress mariadb nginx wp-admin