-
Notifications
You must be signed in to change notification settings - Fork 601
/
Makefile
58 lines (44 loc) · 1.73 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
default:
@echo "Call a specific subcommand:"
@echo
@$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null\
| awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}'\
| sort\
| grep -E -v -e '^[^[:alnum:]]' -e '^$@$$'
@echo
@exit 1
.state/docker-build-web: Dockerfile dev-requirements.txt base-requirements.txt
# Build web container for this project
docker compose build --force-rm web
# Mark the state so we don't rebuild this needlessly.
mkdir -p .state && touch .state/docker-build-web
.state/db-migrated:
# Call migrate target
make migrate
# Mark the state so we don't rebuild this needlessly.
mkdir -p .state && touch .state/db-migrated
.state/db-initialized: .state/docker-build-web .state/db-migrated
# Load all fixtures
docker compose run --rm web ./manage.py loaddata fixtures/*.json
# Mark the state so we don't rebuild this needlessly.
mkdir -p .state && touch .state/db-initialized
serve: .state/db-initialized
docker compose up --remove-orphans
migrations: .state/db-initialized
# Run Django makemigrations
docker compose run --rm web ./manage.py makemigrations
migrate: .state/docker-build-web
# Run Django migrate
docker compose run --rm web ./manage.py migrate
manage: .state/db-initialized
# Run Django manage to accept arbitrary arguments
docker compose run --rm web ./manage.py $(filter-out $@,$(MAKECMDGOALS))
shell: .state/db-initialized
docker compose run --rm web ./manage.py shell
clean:
docker compose down -v
rm -f .state/docker-build-web .state/db-initialized .state/db-migrated
test: .state/db-initialized
docker compose run --rm web ./manage.py test
docker_shell: .state/db-initialized
docker compose run --rm web /bin/bash