-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
49 lines (38 loc) · 1.73 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: elsie <elsie@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2023/08/31 10:10:55 by trobert #+# #+# #
# Updated: 2023/12/23 19:29:43 by elsie ### ########.fr #
# #
# **************************************************************************** #
YML_FILE := docker-compose.yml
DOCKER_VOLUME_LIST := $(shell docker volume ls -q)
ENV_FILE = ".env"
DOCKER_ENV_FILE := ./.env
all: check_env build
check_env:
@if [ ! -f $(ENV_FILE) ]; then \
echo "Error: $(ENV_FILE) not found. Please create the .env file."; \
exit 1; \
fi
@if [ ! -f $(DOCKER_ENV_FILE) ]; then \
echo "Error: $(DOCKER_ENV_FILE) not found. Please create the .envdocker file in the ./backend/ directory."; \
exit 1; \
fi
build: check_env
docker-compose -f $(YML_FILE) up --build -d
stop:
docker-compose -f $(YML_FILE) stop
re: fclean all
clean: stop
docker-compose -f $(YML_FILE) down -v
fclean: clean
# sudo rm -rf ${HOME}/volume
docker system prune -a -f --volumes
@if [ -n "$(DOCKER_VOLUME_LIST)" ]; then docker volume rm $(DOCKER_VOLUME_LIST) 2> /dev/null || true; fi
@echo "Cleaning: success!"
.PHONY: clean fclean all re