This repository has been archived by the owner on Dec 29, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
56 lines (39 loc) · 1.69 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
DOCKER_COMPOSE_PROD_FILE=docker-compose.prod.yml
DOCKER_COMPOSE_DEV_FILE=docker-compose.dev.yml
DOCKER_COMPOSE=docker-compose
DOCKER_BUILDKIT_FLAG=1
.PHONY: up_prod up_dev build_dev build_prod connect_to_backend_dev \
connect_to_backend_prod test_dev test_prod clean_dev fclean_dev logs_prod \
dev prod
# PRODUCTION
prod: build_prod up_prod test_prod logs_prod
build_prod:
DOCKER_BUILDKIT=$(DOCKER_BUILDKIT_FLAG) $(DOCKER_COMPOSE) --file=$(DOCKER_COMPOSE_PROD_FILE) build
up_prod:
$(DOCKER_COMPOSE) --file=$(DOCKER_COMPOSE_PROD_FILE) up -d
logs_prod:
$(DOCKER_COMPOSE) --file=$(DOCKER_COMPOSE_PROD_FILE) logs -f
connect_to_backend_prod:
$(DOCKER_COMPOSE) --file=$(DOCKER_COMPOSE_PROD_FILE) exec backend sh
test_prod:
$(DOCKER_COMPOSE) --file=$(DOCKER_COMPOSE_PROD_FILE) exec -T backend sh -c "coverage run --omit=*/tests* manage.py test --no-input && coverage report"
# DEVELOPMENT
dev: build_dev up_dev
build_dev:
DOCKER_BUILDKIT=$(DOCKER_BUILDKIT_FLAG) $(DOCKER_COMPOSE) --file=$(DOCKER_COMPOSE_DEV_FILE) build
up_dev:
$(DOCKER_COMPOSE) --file=$(DOCKER_COMPOSE_DEV_FILE) up -d
stop_dev:
$(DOCKER_COMPOSE) --file=$(DOCKER_COMPOSE_DEV_FILE) stop
logs_dev:
$(DOCKER_COMPOSE) --file=$(DOCKER_COMPOSE_DEV_FILE) logs -f
connect_to_backend_dev:
$(DOCKER_COMPOSE) --file=$(DOCKER_COMPOSE_DEV_FILE) exec backend sh
test_dev:
$(DOCKER_COMPOSE) --file=$(DOCKER_COMPOSE_DEV_FILE) exec -T backend sh -c "coverage run --omit=*/tests* manage.py test --no-input && coverage report"
# DELETES ALL CONTAINERS AND IMAGES
clean_dev:
$(DOCKER_COMPOSE) --file=$(DOCKER_COMPOSE_DEV_FILE) down
# DELETES ALL CONTAINERS AND IMAGES WITH VOLUMES
fclean_dev:
$(DOCKER_COMPOSE) --file=$(DOCKER_COMPOSE_DEV_FILE) down -v