forked from makepath/makestack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
48 lines (39 loc) · 1.55 KB
/
Copy pathMakefile
File metadata and controls
48 lines (39 loc) · 1.55 KB
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
ENTER_BACKEND:=docker-compose exec backend
.PHONY: help
help: ## Show make targets.
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
awk 'BEGIN {FS = ":.*?## "}; \
{printf "\033[36m%-25s", $$1} \
/#__danger/ {printf "\033[31m%s ", "DANGER"} \
{gsub(/#__danger /, ""); printf "\033[0m%s\n", $$2}'
.PHONY: backend-coverage
backend-coverage: ## Enter the running backend container and get coverage tests.
$(ENTER_BACKEND) coverage run -m pytest
$(ENTER_BACKEND) coverage report
$(ENTER_BACKEND) coverage html -d coverage_html
.PHONY: backend-test
backend-test: ## Enter the running backend container and run tests.
$(ENTER_BACKEND) pytest
.PHONY: build-frontend
build-frontend: ## Build the frontend image.
docker build --platform linux/amd64 -t frontend ./docker/frontend/
docker run --user non-privileged \
-v ${PWD}/frontend:/code frontend /bin/bash \
-c "yarn install;yarn build"
cp -a ${PWD}/frontend/build/ ${PWD}/backend/frontend
.PHONY: build
build: build-frontend ## Build necessary stuff.
docker-compose build
.PHONY: enter-backend
enter-backend: ## Enter the backend container.
$(ENTER_BACKEND) bash
.PHONY: first-run
first-run: ## Run migrations and create a default user.
$(ENTER_BACKEND) python manage.py migrate --no-input
$(ENTER_BACKEND) python manage.py create_super_user --email admin@admin.com --password admin --first_name admin --last_name user
.PHONY: start
start: ## Start containers with docker-compose and attach to logs.
docker-compose up --no-build
.PHONY: stop
stop: ## Stop all running containers.
docker-compose stop