-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
128 lines (96 loc) · 4.05 KB
/
Copy pathMakefile
File metadata and controls
128 lines (96 loc) · 4.05 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
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
118
119
120
121
122
123
124
125
126
127
128
# Thanks to https://gist.github.com/miketheman/e17a9e5c6fedac4c34383931c01beb28
CURRENT_DIRECTORY := $(shell pwd)
GIT_SHA := $(shell git rev-parse HEAD)
help:
@echo "Docker Compose Help"
@echo "-----------------------"
@echo ""
@echo "Run tests to ensure current state is good:"
@echo " make test"
@echo ""
@echo "If tests pass, add fixture data and start up the app:"
@echo " make begin"
@echo ""
@echo "To start app (skipping image build and fixture installation):"
@echo " make start"
@echo ""
@echo "To stop app:"
@echo " make stop"
@echo ""
@echo "To stop and start app:"
@echo " make restart"
@echo ""
@echo "To rebuild images (needed after adding dependency):"
@echo " make build"
@echo ""
@echo "Reset container database and volumes:"
@echo " make clean"
@echo ""
@echo "Attach to running Django app:"
@echo " make attach"
@echo ""
@echo "See contents of Makefile for more targets."
begin: build makemigrations migrate local-accounts fixtures start
git config core.hooksPath .githooks
start:
@docker-compose up -d
@echo "Ready at http://localhost/"
stop:
@docker-compose stop
status:
@docker-compose ps
restart: stop start
restart-app:
@docker-compose stop app webpack
@docker-compose up -d
@echo "Ready at http://localhost/"
clean: stop
@docker-compose rm --force
@docker-compose down --volumes
@find . -name \*.pyc -delete
build:
@docker-compose build app
collectstatic:
@docker-compose run --rm app python ./manage.py collectstatic
test:
@docker-compose run -e DJANGO_SETTINGS_MODULE=renters_rights.settings.test --rm app ./wait-for-it.sh db:5432 --timeout=60 -- python ./manage.py test --keepdb $(labels)
testwithcoverage:
@docker-compose run -e DJANGO_SETTINGS_MODULE=renters_rights.settings.test --rm app bash -c "./wait-for-it.sh db:5432 --timeout=60 -- coverage run --source='.' ./manage.py test --keepdb --noinput && coverage html"
testwithcoverage-codecov: build
@docker-compose run -e DJANGO_SETTINGS_MODULE=renters_rights.settings.test -e GIT_SHA=$(GIT_SHA) -e CODECOV_TOKEN=$(CODECOV_TOKEN) --rm app bash -c "./wait-for-it.sh db:5432 --timeout=60 -- coverage run --source='.' ./manage.py test --keepdb --noinput && codecov --commit=$(GIT_SHA)"
makemigrations:
@docker-compose run --rm app ./wait-for-it.sh db:5432 --timeout=60 -- python ./manage.py makemigrations
makemessages:
@docker-compose run --rm app python ./manage.py makemessages -l en
push-strings: # Send strings to a third party for translation
@docker-compose run --rm app tx push --source
pull-translations: # Pull translations from a third party for use in app (should call compilemessages, import-fixture-translations, and fixtures after this step).
@docker-compose run --rm app tx pull --all
export-fixture-strings: # Export strings from fixtures to be translated and then later imported by import-fixture-translations
@docker-compose run --rm app python ./fixture-translations.py --export
import-fixture-translations: # Import translations received from third party into fixtures
@docker-compose run --rm app python ./fixture-translations.py --import
compilemessages:
@docker-compose run --rm app ./wait-for-it.sh db:5432 --timeout=60 -- python ./manage.py compilemessages
migrate:
@docker-compose run --rm app ./wait-for-it.sh db:5432 --timeout=60 -- python ./manage.py migrate
fixtures:
@docker-compose run --rm app ./wait-for-it.sh db:5432 --timeout=60 -- ./load-all-fixtures.sh
local-accounts:
@docker-compose run --rm app ./wait-for-it.sh db:5432 --timeout=60 -- ./manage.py loaddata noauth/fixtures/local.yaml
flushdb:
@docker-compose run --rm app ./wait-for-it.sh db:5432 --timeout=60 -- python ./manage.py flush
bash:
@docker-compose run --rm app bash
tail:
@docker-compose logs -ft
tail-app:
@docker-compose logs -ft app
attach:
docker attach renters-rights_app_1
bash-running:
docker exec -it renters-rights_app_1 bash
format:
@docker-compose run --rm app isort --profile black .
@docker-compose run --rm app black . -l 128
.PHONY: start stop status restart clean build test makemigrations migrate fixtures flushdb cli tail