-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
executable file
·62 lines (48 loc) · 1.35 KB
/
Makefile
File metadata and controls
executable file
·62 lines (48 loc) · 1.35 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
ENV_FILE := srcs/.env
ifeq (,$(wildcard $(ENV_FILE)))
$(error "$(ENV_FILE) is missing, please create it with LOGIN=<your-login>")
endif
include $(ENV_FILE)
export LOGIN
DATA_DIR := $(HOME)/data
MYSQL_DIR := $(DATA_DIR)/mysql
WP_DIR := $(DATA_DIR)/wordpress
UPTIME := $(DATA_DIR)/uptimekuma
SUDO := sudo -E
COMPOSE := $(SUDO) docker-compose -f ./srcs/docker-compose.yaml
.PHONY: all build up log down stop start clean fclean status
all: up
build:
@echo "[+] Creating host dirs for volumes…"
@mkdir -p $(MYSQL_DIR) $(WP_DIR) $(UPTIME)
@sudo chmod 775 $(DATA_DIR)
@echo "[+] Building Docker images…"
@$(COMPOSE) build
up: build
@echo "[+] Starting containers in detached mode…"
@$(COMPOSE) up -d
log: build
@echo "[+] Starting containers with logs attached…"
@$(COMPOSE) up
down:
@echo "[+] Stopping & removing containers…"
@$(COMPOSE) down
stop:
@echo "[+] Stopping containers…"
@$(COMPOSE) stop
start:
@echo "[+] Starting containers…"
@$(COMPOSE) start
clean:
@echo "[+] Pruning Docker (containers, volumes, images)…"
@$(COMPOSE) down -v --rmi all
@sudo docker system prune -af
fclean: clean
@echo "[+] Full clean (Docker + host data)…"
@sudo docker system prune -af
@sudo docker volume prune -f
@sudo docker network prune -f
@sudo rm -rf $(DATA_DIR)/*
status:
@echo "[+] Docker containers status:"
@sudo docker ps