-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
117 lines (101 loc) · 4.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
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
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 &"
dev-load-demo-data:
@echo
@echo "------------------------------------------------------------------"
@echo "Load demo data for dev"
@echo "------------------------------------------------------------------"
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
npm-install:
@echo
@echo "------------------------------------------------------------------"
@echo "Install frontend dependencies"
@echo "------------------------------------------------------------------"
@docker compose ${ARGS} exec -T dev npm --prefix /home/web/django_project/frontend install
migrate:
@echo
@echo "------------------------------------------------------------------"
@echo "Running migration"
@echo "------------------------------------------------------------------"
@docker compose ${ARGS} exec -T dev python manage.py migrate
build-react:
@echo
@echo "------------------------------------------------------------------"
@echo "Execute webpack build command"
@echo "------------------------------------------------------------------"
@docker compose ${ARGS} exec -T dev npm --prefix /home/web/django_project/frontend run build
serve:
@echo
@echo "------------------------------------------------------------------"
@echo "Execute webpack serve command"
@echo "------------------------------------------------------------------"
@cd django_project/frontend; npm install --verbose; npm run serve;
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"