-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
47 lines (38 loc) · 1.34 KB
/
Copy pathMakefile
File metadata and controls
47 lines (38 loc) · 1.34 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
DOCKER=docker
CONTAINERS = $(shell ${DOCKER} ps -aq)
IMAGES= $(shell ${DOCKER} images -aq)
VOLUMES= $(shell ${DOCKER} volume ls -q)
NETWORKS= $(shell ${DOCKER} network ls -q)
COMPOSE=./docker-compose.yml
all :
$(DOCKER) compose -f ${COMPOSE} build --no-cache --parallel --force-rm --pull
$(DOCKER) compose -f ${COMPOSE} up -d --remove-orphans
front:
$(DOCKER) compose -f ${COMPOSE} build frontend
$(DOCKER) compose -f ${COMPOSE} up frontend -d
logs :
@if [[ $$1 ]]; then \
$(DOCKER) compose -f ${COMPOSE} logs -f $$1; \
else \
$(DOCKER) compose -f ${COMPOSE} logs -f; \
fi
backend:
$(DOCKER) compose -f ${COMPOSE} build backend --no-cache
$(DOCKER) compose -f ${COMPOSE} up backend -d
start:
$(DOCKER) compose -f ${COMPOSE} start
stop :
$(DOCKER) compose -f ${COMPOSE} stop
clean :
@echo "start cleaning"
@$(DOCKER) compose -f ${COMPOSE} stop
@$(DOCKER) compose -f ${COMPOSE} down --remove-orphans --rmi all -v
@$(DOCKER) rm $(CONTAINERS) 2> /dev/null || echo "no containers to clean"
@$(DOCKER) rmi -f $(IMAGES) 2> /dev/null || echo "no image to clean"
@$(DOCKER) volume rm -f $(VOLUMES) 2> /dev/null || echo "no volume to clean"
@$(DOCKER) network rm -f $(NETWORKS) 2> /dev/null || echo "no network to clean"
@echo "cleaned"
fclean: clean
@$(DOCKER) system prune -a --volumes -f
re : fclean all
.PHONY: front backend logs clean stop fclean