1
- default :
1
+ help :
2
2
@echo " Call a specific subcommand:"
3
3
@echo
4
- @$(MAKE ) -pRrq -f $(lastword $(MAKEFILE_LIST ) ) : 2> /dev/null\
5
- | awk -v RS= -F : '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}'\
6
- | sort\
7
- | grep -E -v -e '^[^[:alnum:]]' -e '^$@$$'
4
+ @grep -E ' ^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST ) \
5
+ | awk ' BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
8
6
@echo
9
- @exit 1
7
+
8
+ default : help
10
9
11
10
.state/docker-build-web : Dockerfile dev-requirements.txt base-requirements.txt
12
11
# Build web container for this project
@@ -29,30 +28,29 @@ default:
29
28
# Mark the state so we don't rebuild this needlessly.
30
29
mkdir -p .state && touch .state/db-initialized
31
30
32
- serve : .state/db-initialized
31
+ serve : .state/db-initialized # # Start the application
33
32
docker compose up --remove-orphans
34
33
35
- migrations : .state/db-initialized
36
- # Run Django makemigrations
34
+ migrations : .state/db-initialized # # Generate migrations from models
37
35
docker compose run --rm web ./manage.py makemigrations
38
36
39
- migrate : .state/docker-build-web
40
- # Run Django migrate
37
+ migrate : .state/docker-build-web # # Run Django migrate
41
38
docker compose run --rm web ./manage.py migrate
42
39
43
- manage : .state/db-initialized
44
- # Run Django manage to accept arbitrary arguments
40
+ manage : .state/db-initialized # # Run Django manage to accept arbitrary arguments
45
41
docker compose run --rm web ./manage.py $(filter-out $@ ,$(MAKECMDGOALS ) )
46
42
47
- shell : .state/db-initialized
43
+ shell : .state/db-initialized # # Open Django interactive shell
48
44
docker compose run --rm web ./manage.py shell
49
45
50
- clean :
46
+ clean : # # Clean up the environment
51
47
docker compose down -v
52
48
rm -f .state/docker-build-web .state/db-initialized .state/db-migrated
53
49
54
- test : .state/db-initialized
50
+ test : .state/db-initialized # # Run tests
55
51
docker compose run --rm web ./manage.py test
56
52
57
- docker_shell : .state/db-initialized
53
+ docker_shell : .state/db-initialized # # Open a bash shell in the web container
58
54
docker compose run --rm web /bin/bash
55
+
56
+ .PHONY : help serve migrations migrate manage shell clean test docker_shell
0 commit comments