-
Notifications
You must be signed in to change notification settings - Fork 9
/
Makefile
46 lines (31 loc) · 1.24 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
.PHONY: build, re-build, up, down, list, logs, test, makemigrations
DOCKER_VERSION := $(shell docker --version 2>/dev/null)
env ?= local
docker_config_file ?= docker-compose.$(env).yaml
all:
ifndef DOCKER_VERSION
$(error "command docker is not available, please install Docker")
endif
re-build:
docker compose -f $(docker_config_file) build --no-cache
build:
docker compose -f $(docker_config_file) build
up:
docker compose -f $(docker_config_file) up -d
down:
docker compose -f $(docker_config_file) down
list:
docker compose -f $(docker_config_file) ps
logs:
docker compose -f $(docker_config_file) logs
makemigrations: up
docker compose -f $(docker_config_file) exec django bash -c "python manage.py makemigrations"
migrate: up
docker compose -f $(docker_config_file) exec django bash -c "python manage.py migrate"
checkmigration:
docker compose -f $(docker_config_file) exec django bash -c "python manage.py makemigrations --check --dry-run"
test: up
docker exec django bash -c "python manage.py test --keepdb --parallel=$(nproc)"
test_coverage: up
docker exec django bash -c "coverage run manage.py test --settings=config.settings.test --keepdb --parallel=$(nproc)"
docker exec django bash -c "coverage combine || true; coverage report"