-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
44 lines (35 loc) · 1.05 KB
/
Makefile
File metadata and controls
44 lines (35 loc) · 1.05 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
SRCS = ./srcs
DOCKER = sudo docker
COMPOSE = sudo docker-compose
DATA_PATH = /home/fvoicu/data
ENV_FILE_PATH = /home/fvoicu/.env
all: copy_env build
sudo mkdir -p $(DATA_PATH)
sudo mkdir -p $(DATA_PATH)/wordpress
sudo mkdir -p $(DATA_PATH)/mariadb
sudo chmod 777 /etc/hosts
sudo chmod 777 /home/fvoicu/data/mariadb
sudo chmod 777 /home/fvoicu/data/wordpress
echo "127.0.0.1 fvoicu.42.fr" | sudo tee -a /etc/hosts
echo "127.0.0.1 www.fvoicu.42.fr" | sudo tee -a /etc/hosts
cd $(SRCS) && $(COMPOSE) up -d
copy_env:
sudo cp $(ENV_FILE_PATH) $(SRCS)/.env
build:
cd $(SRCS) && $(COMPOSE) build
up:
cd $(SRCS) && $(COMPOSE) up -d
down:
cd $(SRCS) && $(COMPOSE) down
clean:
cd $(SRCS) && $(COMPOSE) down -v --rmi all --remove-orphans
fclean: clean
$(DOCKER) system prune --volumes --all --force
sudo rm -rf $(DATA_PATH)
$(DOCKER) network prune --force
if [ -n "$$(docker volume ls -q)" ]; then \
docker volume rm $$(docker volume ls -q); \
fi
$(DOCKER) image prune --force
re: fclean all
.PHONY: all build up down clean fclean re