-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
56 lines (44 loc) · 1.65 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
PROFILE ?= dev
SERVICE ?= console
DOCKER_RUN_ARGS ?= --service-ports --rm
.PHONY: help
help:
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
.PHONY: up
up: export DJANGO_SETTINGS_MODULE ?= project.settings
up: ## Run the container and jump into a
@docker compose run ${DOCKER_RUN_ARGS} ${SERVICE} ${COMMAND}
.PHONY: test
test: ## run the tests
test: COMMAND = pytest
test: up
.PHONY: test-circleci
test-circleci: ## run the tests and collect results
test-circleci: COMMAND = pytest --junitxml=test-results/junit.xml
test-circleci: SERVICE = circle_ci_console
test-circleci:
@docker compose run --name nl2sqlapp_console ${SERVICE} ${COMMAND} \
&& { echo "Command succeeded"; } \
|| { ret=$$?; echo "Command failed with exit code $$ret"; docker cp nl2sqlapp_console:/app/test-results/ test-results/; exit $$ret; }
.PHONY: runserver
runserver: ## run the develoment web server
runserver: COMMAND = python manage.py runserver 0.0.0.0:8000
runserver: up
.PHONY: stop
stop: ## stop Docker containers without removing them
@docker compose stop || true
.PHONY: start
start: ## setup the dabase and download the models.
start: COMMAND = python manage.py migrate --no-input
start: up
start: COMMAND = python manage.py pull_models
start: up
.PHONY: down
down: ## Stop and remove all the containers
@docker compose down --remove-orphans
.PHONY: build
build: ## Build the container using cache
@docker compose build ${SERVICE}
.PHONY: build-no-cache
build-no-cache: ## Build the container without use cache
@docker compose build --no-cache ${SERVICE}