-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
90 lines (78 loc) · 3.29 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
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
export COMPOSE_FILE=deployment/docker-compose.yml:deployment/docker-compose.override.yml
SHELL := /bin/bash
build:
@echo
@echo "------------------------------------------------------------------"
@echo "Building in production mode"
@echo "------------------------------------------------------------------"
@docker compose build dev
up:
@echo
@echo "------------------------------------------------------------------"
@echo "Running in production mode"
@echo "------------------------------------------------------------------"
@docker compose ${ARGS} up -d nginx django
dev:
@echo
@echo "------------------------------------------------------------------"
@echo "Running in dev mode"
@echo "------------------------------------------------------------------"
@docker compose ${ARGS} up -d dev
shell:
@echo
@echo "------------------------------------------------------------------"
@echo "Shelling in in production mode"
@echo "------------------------------------------------------------------"
@docker compose exec django /bin/bash
dev-entrypoint:
@echo
@echo "------------------------------------------------------------------"
@echo "Running in DEVELOPMENT mode"
@echo "------------------------------------------------------------------"
@docker compose ${ARGS} exec -T dev "/home/web/django_project/entrypoint.sh"
dev-runserver:
@echo
@echo "------------------------------------------------------------------"
@echo "Start django runserver in dev container"
@echo "------------------------------------------------------------------"
@docker compose $(ARGS) exec -T dev bash -c "nohup python manage.py runserver 0.0.0.0:5000 &"
load-initiate-data:
@echo
@echo "------------------------------------------------------------------"
@echo "Load initiate data"
@echo "------------------------------------------------------------------"
@docker compose $(ARGS) exec -T dev bash -c "python manage.py loaddata geohosting_controller/fixtures/01.initiate.json"
dev-test:
@echo
@echo "------------------------------------------------------------------"
@echo "Run tests"
@echo "------------------------------------------------------------------"
@docker compose exec -T dev python manage.py collectstatic --noinput
@docker compose exec -T dev python manage.py test --keepdb --noinput
down:
@echo
@echo "------------------------------------------------------------------"
@echo "Removing production instance!!! "
@echo "------------------------------------------------------------------"
@docker compose down
test-flake:
@echo
@echo "------------------------------------------------------------------"
@echo "Running flake8"
@echo "------------------------------------------------------------------"
@pip install flake8==6.0.0
@pip install flake8-docstrings
@python3 -m flake8 django_project
wait-db:
@echo
@echo "------------------------------------------------------------------"
@echo "Check database is ready or not"
@echo "------------------------------------------------------------------"
@docker compose ${ARGS} exec -T db su - postgres -c "until pg_isready; do sleep 5; done"
sleep:
@echo
@echo "------------------------------------------------------------------"
@echo "Sleep for 50 seconds"
@echo "------------------------------------------------------------------"
@sleep 50
@echo "Done"