-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathMakefile
83 lines (60 loc) · 2.12 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
SHELL := /bin/bash
PYTHON=python3.8
DJANGO_MANAGE=api/manage.py
ENV_DIR=.$(PYTHON)_env
IN_ENV=. $(ENV_DIR)/bin/activate
all:
@./.djengu/create.sh
build-dev: env-dev build-python migrations run-django-scripts
cd frontend && npm i
build-python:
virtualenv -p $(PYTHON) $(ENV_DIR)
$(IN_ENV) && pip3 install -r api/requirements.txt
build-dev-frontend: env-dev
@cd frontend && npm i && npx quasar build -m ssr
build-prod-frontend: env-prod
@cd frontend && npm i && npx quasar build -m ssr
backend-serve: env-dev migrations
$(IN_ENV) && python $(DJANGO_MANAGE) runserver
configure-vagrant:
@sudo ./.djengu/.production_toolbox/vagrant_etchosts.sh
@./.djengu/.production_toolbox/caddy/vagrant_caddy.sh
clean:
@rm -rf $(ENV_DIR)
@rm -rf node_modules frontend/node_modules
@rm -rf package-lock.json frontend/package-lock.json
@rm -rf frontend/dist frontend/src-ssr
@rm -rf .pytest_cache
@echo "Environment cleaned."
deploy: env-prod env-sub build-prod-frontend
echo "Building ${ENVIRONMENT} Environment"
docker-compose up --build -d
decrypt-dotenv: env-dev
gpg --quiet --batch --yes --decrypt --passphrase=ENCRYPTION_KEY env.tar.gpg | tar -x
encrypt-dotenv:
tar -c env/ | gpg --symmetric -c -o env.tar.gpg
env-dev:
$(eval include env/.env.dev)
$(eval export $(shell sed 's/=.*//' env/.env.dev))
env-test:
$(eval include env/.env.test)
$(eval export $(shell sed 's/=.*//' env/.env.test))
env-prod:
$(eval include env/.env.prod)
$(eval export $(shell sed 's/=.*//' env/.env.prod))
env-sub: env-prod
@envsubst < "docker-compose.prod.yml" > "docker-compose.yml"
flush-the-database-yes-really: env-dev
$(IN_ENV) && python $(DJANGO_MANAGE) flush
frontend-serve: env-dev
cd frontend && npx quasar dev -m ssr
frontend-prod-serve: env-prod
cd frontend/dist/ssr/ && npm run start
migrations: env-dev
$(IN_ENV) && python $(DJANGO_MANAGE) makemigrations --noinput
$(IN_ENV) && python $(DJANGO_MANAGE) migrate --noinput
run-django-scripts: env-dev
@$(IN_ENV) && python $(DJANGO_MANAGE) runscript create_test_users
test: env-test build-python
$(IN_ENV) && $(PYTHON) -m pytest api/tests/
test-build: env-test build-python build-dev-frontend