-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
63 lines (48 loc) · 1.44 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
.DEFAULT_GOAL := help
SERVICE ?=
help:
@echo "help -- print this help"
@echo "build -- build docker environment"
@echo "up -- start docker stack"
@echo "down -- stop docker stack"
@echo "env -- create a virtualenv"
@echo "clean -- clean all artifacts"
env: env/bin/activate
.PHONY: build
build: .build
.PHONY: up
up: build
@. env/bin/activate; docker-compose up $(SERVICE)
.PHONY: down
down:
@. env/bin/activate; docker-compose stop $(SERVICE)
.PHONY: clean
clean: clean-docker clean-env
@rm -f .build
# helpers
env/bin/activate: build-requirements.txt
@test -d env || virtualenv env
@. env/bin/activate; pip install -r build-requirements.txt
@touch env/bin/activate
.build: env docker-compose.yml
@. env/bin/activate; docker-compose build $(SERVICE)
@touch .build
.PHONY: clean-docker
clean-docker:
@. env/bin/activate; docker-compose rm --force
.PHONY: clean-env
clean-env:
@rm -rf env
.PHONY: .env
.env:
@echo "DATABASE_URL=postgres://docker:docker@${DB_1_PORT_5432_TCP_ADDR}:${DB_1_PORT_5432_TCP_PORT}/docker" > .env
@echo "BROKER_URL=amqp://guest:guest@${AMQP_1_PORT_5672_TCP_ADDR}:${AMQP_1_PORT_5672_TCP_PORT}/" >> .env
@echo "DEBUG=True" >> .env
@echo "C_FORCE_ROOT=1" >> .env
start: .env
@python manage.py syncdb --noinput
@python manage.py migrate --noinput
@python manage.py collectstatic --noinput
@foreman start
superuser:
@docker-compose run app python /usr/src/app/manage.py createsuperuser