Makefile 2.02 KB
Newer Older
Florent Chehab's avatar
Florent Chehab committed
1
.PHONY: documentation
2

3
setup:
4
	bash server/envs/init.sh
5 6

clear_setup:
7 8
	rm server/envs/db.env
	rm server/envs/django.env
9 10

up: setup
11 12 13 14 15 16 17 18 19
	docker-compose up --build

dev: up

down_dev:
	docker-compose down

init_dev_data:
	docker-compose exec backend sh -c "cd backend && ./manage.py shell < init_dev_data.py"
20

Florent Chehab's avatar
Florent Chehab committed
21 22
docker-pull:
	docker-compose pull
Florent Chehab's avatar
Florent Chehab committed
23

Florent Chehab's avatar
Florent Chehab committed
24 25 26
reformat_backend:
	docker-compose exec backend sh -c "cd backend && black ."

Florent Chehab's avatar
Florent Chehab committed
27
test_backend:
28
	docker-compose exec backend sh -c "cd backend && pytest --cov --cov-config .coveragerc --cov-report term   base_app/ backend_app/"
29

30 31 32
test_frontend:
	docker-compose exec frontend sh -c "cd frontend && npm run test"

33
check_backend:
Florent Chehab's avatar
Florent Chehab committed
34 35 36 37 38 39 40 41 42 43
	docker-compose exec backend sh -c "cd backend && ./manage.py check"

lint_backend:
	docker-compose exec backend sh -c "cd backend && flake8"

lint_frontend:
	docker-compose exec frontend sh -c "cd frontend && npm run lint"

build_frontend:
	docker-compose exec frontend sh -c "cd frontend && npm run build"
44

Florent Chehab's avatar
Florent Chehab committed
45
shell_backend:
46
	docker-compose exec backend sh -c "cd backend && bash"
47

Florent Chehab's avatar
Florent Chehab committed
48
shell_frontend:
49 50 51 52
	docker-compose exec frontend sh -c "cd frontend && sh"

django_shell:
	docker-compose exec backend sh -c "cd backend && ./manage.py shell"
53

54
# Create or update UML diagrams for the documentation
55
documentation:
56 57
	docker-compose exec backend bash -c "cd documentation && make extract_django"
	docker-compose exec gen_doc_uml bash -c "cd /usr/src/app/documentation && make convert_to_svg"
58

59
documentation_clean:
60
	docker-compose exec backend bash -c "cd documentation && make clean"
61 62 63 64 65 66 67 68 69 70 71

prod_yml = -f ./server/docker-compose.prod.yml

prod: setup
	$(info In production, we need to reset the webpack-stats.json file to make sure the front is up-to-date)
	sudo rm -f frontend/webpack-stats.json
	docker-compose $(prod_yml) up --build -d

down_prod:
	docker-compose $(prod_yml) down

72 73 74
prod_docker_logs:
	docker-compose $(prod_yml) logs

75 76 77 78 79
shell_prod_logs:
	docker-compose $(prod_yml) exec logs_rotation /bin/sh -c "cd /var/log && /bin/sh"

shell_backend_prod:
	docker-compose $(prod_yml) exec backend sh -c "cd backend && bash"