-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
80 lines (62 loc) · 2.25 KB
/
Makefile
File metadata and controls
80 lines (62 loc) · 2.25 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
DOCKER_COMPOSE = docker compose -f srcs/docker-compose.yml
STATIC_WEBSITE_PATH_ON_HOST = /home/${USER}/Sites/static
SECRETS_PATH = secrets
ENV_FILE = srcs/.env
TOOLS_PATH = srcs/requirements/tools
VOLUMES_PATH = /home/${USER}/data
WORDPRESS_VOLUME = $(VOLUMES_PATH)/wordpress
MARIADB_VOLUME = $(VOLUMES_PATH)/mariadb
all: secrets env volumes up
secrets:
@$(TOOLS_PATH)/make_secrets.sh
env:
@$(TOOLS_PATH)/make_env.sh
volumes:
mkdir -p $(WORDPRESS_VOLUME)
mkdir -p $(MARIADB_VOLUME)
up:
$(DOCKER_COMPOSE) up -d
down:
$(DOCKER_COMPOSE) down
clean:
$(DOCKER_COMPOSE) down -v
docker system prune -af
fclean: clean
-docker stop $(shell docker ps -qa)
-docker rm $(shell docker ps -qa)
-docker rmi -f $(shell docker images -qa)
-docker volume rm $(shell docker volume ls -q)
-docker network rm $(shell docker network ls -q)
sudo rm -rf $(WORDPRESS_VOLUME) $(MARIADB_VOLUME)
rm -rf $(SECRETS_PATH)
rm -f $(ENV_FILE)
restart: down up
re: clean all
fre: fclean all
nginx:
$(DOCKER_COMPOSE) build nginx
$(DOCKER_COMPOSE) up -d --force-recreate nginx
wordpress:
$(DOCKER_COMPOSE) build wordpress
$(DOCKER_COMPOSE) up -d --force-recreate wordpress
static:
$(DOCKER_COMPOSE) build static
$(DOCKER_COMPOSE) up -d
ftp:
$(DOCKER_COMPOSE) build ftp
$(DOCKER_COMPOSE) up -d --force-recreate ftp
help:
@echo "Available commands:"
@echo "'make secrets': create 'secrets' folder and passwords files inside it"
@echo "'make env': generate srcs/.env file based on files inside the 'secrets' folder"
@echo "'make up': build images and start containers"
@echo "'make down': stop containers"
@echo "'make clean': stop and remove containers, remove images and volumes"
@echo "'make fclean': same as 'make clean' + delete srcs/.env and secrets folder + rm volumes and networks of any other projects"
@echo "'make re': equivalent of doing 'make clean' then 'make'"
@echo "'make fre': equivalent of doing 'make fclean' then 'make'"
@echo "'make nginx': clear and rebuild the 'nginx' container"
@echo "'make wordpress': clear and rebuild the 'wordpress' container"
@echo "'make static': clear and rebuild the 'static' container"
@echo "'make help': get a list of available commands"
.PHONY: all secrets env volumes up down clean fclean re fre nginx wordpress static ftp help