-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
68 lines (46 loc) · 2.11 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
PY = poetry run python
DOCKER_COMPOSE = ./docker-compose.yml
DOCKER_COMPOSE_SERVER = sudo docker compose -f
BUILD = build
UP = up
MANAGE = advertisements/manage.py
RUNSERVER = runserver
MIGRATE = migrate
MAKEMIGRATIONS = makemigrations
COLLECTSTATIC = collectstatic
CREATESUPERUSER = createsuperuser
FLAGS_NO_CACHE = --force-rm --no-cache
.PHONY: all
all: help
runserver: run_local_server
migrate: local_migrate_database
makemigrations: local_makemigrations_database
collectstatic: local_collectstatic_static_files
createsuperuser: local_createsuperuser_database
up: docker-up
build: docker-build
build-no-cache: docker-build-no-cache
clean: docker-clear-cache
help: help-makefile
run_local_server:
@$(PY) $(MANAGE) $(RUNSERVER)
local_migrate_database:
@$(PY) $(MANAGE) $(MIGRATE)
local_makemigrations_database:
@$(PY) $(MANAGE) $(MAKEMIGRATIONS)
local_collectstatic_static_files:
@$(PY) $(MANAGE) $(COLLECTSTATIC)
local_createsuperuser_database:
@$(PY) $(MANAGE) $(CREATESUPERUSER)
docker-up:
@$(DOCKER_COMPOSE_SERVER) "$(DOCKER_COMPOSE)" $(UP)
docker-build:
@$(DOCKER_COMPOSE_SERVER) "$(DOCKER_COMPOSE)" $(BUILD)
docker-build-no-cache:
@$(DOCKER_COMPOSE_SERVER) "$(DOCKER_COMPOSE)" $(BUILD) $(FLAGS_NO_CACHE)
docker-clear-cache:
@yes y | sudo docker container prune && yes y | sudo docker builder prune && sudo docker image prune -a -f
help-makefile:
@echo -e "Makefile for SerphantomApplication\n"
@echo -e "Django Framework:\nrunserver -> starting a local server\nmigrate -> starting database and project migration\nmakemigrations -> preparing to launch database and project migrations\ncollectstatic -> collecting static files in the staticfiles directory\ncreatesuperuser -> creating a superuser in the framework database\n"
@echo -e "Docker-compose on server:\nup -> starting the operation of the assembled docker container\nbuild -> starting the build of the docker container of the project\nbuild-no-cache -> running a docker project container build without using the cache\nclean -> starting to clear the cache from docker builder, container, image"