-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
89 lines (67 loc) · 2.03 KB
/
Makefile
File metadata and controls
89 lines (67 loc) · 2.03 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
86
87
88
89
VOLUMES_PATH = $(HOME)/data
all: create_env create_path build_all
# Create .env file
create_env:
@if [ -f "srcs/.env" ]; then \
echo ".env exists"; \
else \
echo "Creating .env"; \
python3 srcs/requirements/tools/environment.py; \
fi
# Create necessary directories
create_path:
mkdir -p $(VOLUMES_PATH)/wordpress_vol
mkdir -p $(VOLUMES_PATH)/mariadb_vol
# Build images using cache
build:
cd srcs && docker-compose build
# Build images without cache
rebuild:
cd srcs && docker-compose build --no-cache
# Start services without rebuilding
up:
cd srcs && docker-compose up -d
# Build images and start services
build_all:
cd srcs && docker-compose up -d --build
# Start services without building
build_fast:
cd srcs && docker-compose up -d
# Stop and remove containers
down:
cd srcs && docker-compose down
# Restart containers without rebuilding
restart:
cd srcs && docker-compose down && docker-compose up -d
# Completely reset environment (remove containers, volumes and networks)
reset:
cd srcs && docker-compose down -v --remove-orphans
cd srcs && docker-compose up -d --build
# Show logs
logs:
docker logs nginx && docker logs mariadb && docker logs wordpress
# Delete .env file
delete_env:
cd srcs && rm .env
# Delete volumes
delete_volumes:
docker volume rm srcs_mariadb_vol && docker volume rm srcs_wordpress_vol && cd $(VOLUMES_PATH) && rm -rf mariadb_vol && rm -rf wordpress_vol
# Interact with nginx
interact_nginx:
docker exec -it nginx /bin/bash
# Interact with mariadb
interact_mariadb:
docker exec -it mariadb /bin/bash
# Interact with wordpress
interact_wordpress:
docker exec -it wordpress /bin/bash
# Navigate mariadb
enter_db_prompt:
docker exec -it mariadb mysql -u root -p
clean: down
fclean:
cd srcs && docker-compose down -v --remove-orphans
cd srcs && docker system prune -af --volumes
re: fclean all
# eval_rule:
# docker stop $(docker ps -qa); docker rm $(docker ps -qa); docker rmi -f $(docker images -qa); docker volume rm $(docker volume ls -q); docker network rm $(docker network ls -q) 2>/dev/null