-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
67 lines (56 loc) · 1.54 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
# Define variables
PROJECT_NAME = jkuatapp
DOCKER_COMPOSE = docker-compose
DOCKER_EXEC = $(DOCKER_COMPOSE) exec web
PYTHON_MANAGE = $(DOCKER_EXEC) python manage.py
# Default target when running 'make' without arguments
.PHONY: help
help:
@echo "Available targets:"
@echo " help - Show this help message"
@echo " build - Build the Docker images"
@echo " up - Start the Docker containers"
@echo " down - Stop and remove the Docker containers"
@echo " shell - Open a shell in the web container"
@echo " migrate - Run Django database migrations"
@echo " createsuperuser - Create a superuser for Django admin"
@echo " test - Run Django tests"
@echo " lint - Run code linters"
@echo " clean - Remove generated files and directories"
# Build Docker images
.PHONY: build
build:
$(DOCKER_COMPOSE) build
# Start Docker containers
.PHONY: up
up:
$(DOCKER_COMPOSE) up -d
# Stop and remove Docker containers
.PHONY: down
down:
$(DOCKER_COMPOSE) down
# Open a shell in the web container
.PHONY: shell
shell:
$(DOCKER_EXEC) bash
# Run Django database migrations
.PHONY: migrate
migrate:
$(PYTHON_MANAGE) migrate
# Create a superuser for Django admin
.PHONY: createsuperuser
createsuperuser:
$(PYTHON_MANAGE) createsuperuser
# Run Django tests
.PHONY: test
test:
$(PYTHON_MANAGE) test
# Run code linters
.PHONY: lint
lint:
$(DOCKER_EXEC) flake8 .
# Remove generated files and directories
.PHONY: clean
clean:
find . -name "*.pyc" -exec rm -f {} \;
rm -rf __pycache__ .cache