-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
66 lines (44 loc) · 2.07 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
.PHONY: help
.DEFAULT_GOAL := help
BASH = docker-compose run --rm djangoapp /bin/bash
DEV_BASH = docker-compose -f docker-compose-dev.yml run --rm dev /bin/bash
all: dev-setup build up-no-start migrate superuser up ## Setup, build, init, create super user and start application.
own: ## Chown files and directories (use it without sudo).
@sudo chown -R $(USER):$(USER) *
@sudo chown $(USER):$(USER) .*
build: ## Build the images for Django and Shiny.
@docker-compose build
build-django: ## Build the image for Django.
@docker-compose build djangoapp
build-shiny: ## Build the image for Shiny.
@docker-compose build shinyapp
dev-setup: dev-yarn ## Setup the project for development.
dev-yarn: ## Run yarn in the static folder.
@$(DEV_BASH) -c "cd djangoapp/static; yarn"
initial-migration: ## Create the initial Django migration.
@$(BASH) -c "cd djangoapp; ./manage.py makemigrations djangoapp"
migrations: ## Make the subsequent migrations.
@$(BASH) -c "cd djangoapp; ./manage.py makemigrations"
delete-migrations: ## Delete the migrations.
@rm -rf djangoapp/djangoapp/migrations
new-migrations: delete-migrations initial-migration ## Delete all migrations and re-create the initial one.
migrate: ## Migrate (create) the database.
@$(BASH) -c "cd djangoapp; ./manage.py migrate"
up: ## Start the application.
@docker-compose up
up-no-start: ## Create the containers without starting them.
@docker-compose up --no-start
down: ## Stop and remove the containers.
@docker-compose down
superuser: ## Create a Django superuser.
@$(BASH) -c "cd djangoapp; ./manage.py createsuperuser"
shell: ## Launch a shell in the Django container.
@$(BASH)
python: ## Launch a Python shell in the Django container.
@$(BASH) -c "cd djangoapp; ./manage.py shell_plus"
prune: ## Run docker system prune command (use with caution).
@docker system prune -f
delete-database-volume: down ## Delete the database volume.
@docker volume rm -f djangdjangoapp_data
help: ## Print this help.
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) | sort