-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
59 lines (41 loc) · 1.13 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
55
56
57
58
59
USER=andrefil
MARIA_DB_DIR=/home/$(USER)/data/mariadb
WP_PHP_DIR=/home/$(USER)/data/wordpress
DOCKER_COMPOSE=./srcs/docker-compose.yml
DOCKER_COMPOSE_EXEC=docker-compose -f $(DOCKER_COMPOSE)
all: config up
config:
@echo "HELLO!!! WELCOME TO INCEPTION."
@if [ ! -f ./srcs/.env ]; then \
wget -O ./srcs/.env https://raw.githubusercontent.com/Andrefcampos/Inception/main/srcs/.env; \
fi
@if ! grep -q '$(USER)' /etc/hosts; then \
echo "127.0.0.1 $(USER).42.fr" | sudo tee -a /etc/hosts > /dev/null; \
fi
@if [ ! -d "$(WP_PHP_DIR)" ]; then \
sudo mkdir -p $(WP_PHP_DIR); \
fi
@if [ ! -d "$(MARIA_DB_DIR)" ]; then \
sudo mkdir -p $(MARIA_DB_DIR); \
fi
up: build
$(DOCKER_COMPOSE_EXEC) up -d
build:
$(DOCKER_COMPOSE_EXEC) build
down:
$(DOCKER_COMPOSE_EXEC) down
ps:
$(DOCKER_COMPOSE_EXEC) ps
ls:
docker volume ls
clean:
$(DOCKER_COMPOSE_EXEC) down --rmi all --volumes
fclean: clean
rm ./srcs/.env
docker system prune --force --all --volumes
sudo rm -rf /home/$(USER)
re: fclean all
.PHONY: all up config build down ls clean fclean hard update
hard: update all
update:
sudo apt-get update && sudo apt-get upgrade -yq