-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
90 lines (70 loc) · 2.52 KB
/
Makefile
File metadata and controls
90 lines (70 loc) · 2.52 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
81
82
83
84
85
86
87
88
89
90
ABORT_ON_EXIT = --abort-on-container-exit --exit-code-from eapi
ENV_FILE = --env-file .env
COMPOSE_FILE = docker/docker-compose.yml
DOCKER_COMPOSE = docker compose $(ENV_FILE) -f $(COMPOSE_FILE)
COMPOSE_DEV_FILE = docker/docker-compose-dev.yml
DOCKER_COMPOSE_DEV = docker compose $(ENV_FILE) -f $(COMPOSE_DEV_FILE)
COMPOSE_TEST_FILE = docker/docker-compose-tests.yml
DOCKER_COMPOSE_TESTS = $(DOCKER_COMPOSE) -f $(COMPOSE_TEST_FILE)
COMPOSE_ALL_TEST_FILE = docker/docker-compose-all-tests.yml
DOCKER_COMPOSE_ALL_TESTS = $(DOCKER_COMPOSE) -f $(COMPOSE_ALL_TEST_FILE)
API_SERVICE = eapi
DATABASE_SERVICE = db
# ------------------------------
# PHONY TARGETS
# ------------------------------
.PHONY: all detach build down clean fclean re logs dev dev-down test test-all \
docker-up docker-build docker-up-detach docker-down docker-logs \
docker-logs-db docker-logs-all docker-clean docker-clean-with-volumes
# ------------------------------
# MAIN TARGETS
# ------------------------------
all: docker-up
detach: docker-up-detach
build: docker-build
down: docker-down
clean: docker-clean
fclean: docker-clean-with-volumes
re: clean all
logs: docker-logs
# ------------------------------
# DEV TARGETS
# ------------------------------
dev:
@$(DOCKER_COMPOSE_DEV) up --detach --build
dev-down:
@$(DOCKER_COMPOSE_DEV) down --remove-orphans
# ------------------------------
# TEST TARGETS
# ------------------------------
test:
@$(DOCKER_COMPOSE_TESTS) up $(API_SERVICE) --build $(ABORT_ON_EXIT)
@$(DOCKER_COMPOSE_TESTS) down --remove-orphans
test-all:
@$(DOCKER_COMPOSE_ALL_TESTS) up $(API_SERVICE) --build $(ABORT_ON_EXIT)
@$(DOCKER_COMPOSE_ALL_TESTS) down --remove-orphans
# ------------------------------
# DOCKER TARGETS
# ------------------------------
docker-up:
@$(DOCKER_COMPOSE) up $(API_SERVICE) --build $(ABORT_ON_EXIT)
docker-build:
@$(DOCKER_COMPOSE) build
docker-up-detach:
@$(DOCKER_COMPOSE) up --build --detach
docker-down:
@$(DOCKER_COMPOSE) down --remove-orphans
docker-logs:
@$(DOCKER_COMPOSE) logs $(API_SERVICE) -f
docker-logs-db:
@$(DOCKER_COMPOSE) logs $(DATABASE_SERVICE) -f || true
docker-logs-all:
@$(DOCKER_COMPOSE) logs -f || true
docker-clean:
@$(DOCKER_COMPOSE) down --remove-orphans --rmi all
@$(DOCKER_COMPOSE_TESTS) down --remove-orphans --rmi all
@$(DOCKER_COMPOSE_ALL_TESTS) down --remove-orphans --rmi all
docker-clean-with-volumes:
@$(DOCKER_COMPOSE) down --remove-orphans --rmi all -v
@$(DOCKER_COMPOSE_TESTS) down --remove-orphans --rmi all -v
@$(DOCKER_COMPOSE_ALL_TESTS) down --remove-orphans --rmi all -v