forked from cjlee112/socraticqs2
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
97 lines (74 loc) · 2.19 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
env :=
DEV_ENV := dev
STAGE_ENV := stage
PROD_ENV := prod
NGINX_HOST = localhost
NGINX_PORT = 8080
GIT_TAG := $(shell git describe --abbrev=0)
VERSION :=
ifneq ($(filter $(env),$(STAGE_ENV) $(PROD_ENV)),)
DOCKERFILE_PATH := prod.yml
APP = app
export NGINX_HOST
export NGINX_PORT
else
DOCKERFILE_PATH := dev.yml
APP = dev_app
endif
sh:
docker-compose -f $(DOCKERFILE_PATH) run $(APP) bash
run:
docker-compose -f $(DOCKERFILE_PATH) up
start:
docker-compose -f $(DOCKERFILE_PATH) start
debug:
docker-compose -f dev.yml run --service-ports dev_app
build: .build .migrate .load-fixtures .fsm-deploy .react
ifneq ($(filter $(env),$(STAGE_ENV) $(PROD_ENV)),)
make .static
endif
.build:
docker-compose -f $(DOCKERFILE_PATH) build
.migrate:
docker-compose -f $(DOCKERFILE_PATH) run $(APP) \
python manage.py migrate
.fsm-deploy:
docker-compose -f $(DOCKERFILE_PATH) run $(APP) \
python manage.py fsm_deploy
.load-fixtures:
docker-compose -f $(DOCKERFILE_PATH) run $(APP) \
python manage.py loaddata dumpdata/debug-wo-fsm.json
.init-data:
docker-compose -f $(DOCKERFILE_PATH) run $(APP) \
python manage.py flush
docker-compose -f $(DOCKERFILE_PATH) run $(APP) \
python manage.py loaddata dumpdata/debug-wo-fsm.json
.static: .node
docker-compose -f $(DOCKERFILE_PATH) run --no-deps $(APP) \
python manage.py collectstatic --noinput
.react:
docker-compose -f $(DOCKERFILE_PATH) run react
.prepare-geo:
docker-compose -f $(DOCKERFILE_PATH) run --no-deps $(APP) \
bash -c \
" \
find . | grep -E "GeoLiteCity.dat.gz" | xargs rm -rf && \
wget -q http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz && \
gunzip GeoLiteCity.dat.gz && \
mv GeoLiteCity.dat GeoLiteCityLocal.dat \
"
stop:
docker-compose -f $(DOCKERFILE_PATH) stop
rm:
docker-compose -f $(DOCKERFILE_PATH) rm
test:
docker-compose -f $(DOCKERFILE_PATH) run $(APP) \
bash -c \
" \
find . | grep -E \"(__pycache__|\.pyc|\.pyo$\)\" | xargs rm -rf && \
make coverage \
"
version:
echo "Tagged release $(VERSION)\n" > Changelog-$(VERSION).txt
git log --oneline --no-decorate --no-merges $(GIT_TAG)..HEAD >> Changelog-$(VERSION).txt
git tag -s -F Changelog-$(VERSION).txt $(VERSION)