-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
54 lines (41 loc) · 1.21 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
FIRST_RUNNING_CONTAINER = $(shell docker ps | grep -Eo "[a-z0-9]{12}")
ALL_IMAGES = $(shell docker images -a -q;)
IMAGE_ID_PHP= $(shell docker container ls | grep srcs_php | cut -d" " -f1)
IMAGE_ID_DB=$(shell docker container ls | grep srcs_mariadb | cut -d" " -f1)
IMAGE_ID_NGINX=$(shell docker container ls | grep srcs_nginx | cut -d" " -f1)
SRC = srcs/docker-compose.yml
ENV_FILE = srcs/.env
all:
docker-compose --env-file $(ENV_FILE) -f $(SRC) build
start:
docker-compose -f $(SRC) up -d
stop:
docker stop $(FIRST_RUNNING_CONTAINER)
delete_all:
docker rmi -f $(ALL_IMAGES)
delete_volumes:
docker-compose -f $(SRC) down --volumes
docker volume prune
rm -r /home/emomkus/data/wp/*
rm -r /home/emomkus/data/db/*
# additional info
info:
docker container ls
# shell environments
php_shell:
docker exec -it $(IMAGE_ID_PHP) /bin/sh
db_shell:
docker exec -it $(IMAGE_ID_DB) /bin/sh
nginx_shell:
docker exec -it $(IMAGE_ID_NGINX) /bin/sh
# backup mariadb state feature
backup:
docker exec -it $(IMAGE_ID_PHP) bash "backup.sh"
requisits:
apt install docker
spt install docker-compose
dirs:
mkdir -p /home/emomkus/data/db
mkdir -p /home/emomkus/data/wp
hack_network:
echo $'\n127.0.0.1 emomkus.42.fr' >> /etc/hosts