-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
50 lines (41 loc) · 1.74 KB
/
Makefile
File metadata and controls
50 lines (41 loc) · 1.74 KB
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
.DEFAULT_GOAL := help
.PHONY: venv
.EXPORT_ALL_VARIABLES:
## GENERAL VARS ##
PRODUCT_NAME = project
SERVICE_NAME = owner
ENV = dev
PROJECT_NAME = $(PRODUCT_NAME)_$(ENV)_$(SERVICE_NAME)
APP_DIR = app
## MYSQL LOCAL VARS ##
MYSQL_PWD = 123456
MYSQL_DB_NAME = $(PROJECT_NAME)
MYSQL_PORT = 3306
## INCLUDE TARGETS ##
include makefiles/deploy.mk
include makefiles/container.mk
include makefiles/virtualenv.mk
## DEVELOPER TARGETS ##
development: runtime-image venv-create venv-install-lib container-up ## Prepare the project for development: make development
@echo "The development environment is ready and running"
generate-requirements: ## Generate requirements.txt: make generate-requirements
@docker container run --workdir "/${APP_DIR}" --rm -it \
-v "${PWD}/${VENV_DIR}":/${VENV_DIR} \
-v "${PWD}/${APP_DIR}":/${APP_DIR} \
-e VENV_DIR=/${VENV_DIR} \
--entrypoint=/resources/venv.sh \
${IMAGE_RUNTIME} pip3.5 freeze > ${APP_DIR}/requirements.txt
development-unit-test: ## Run the unit tests: make development-unit-test
@docker container run --workdir "/${APP_DIR}" --rm -it \
-v "${PWD}/${VENV_DIR}":/${VENV_DIR} \
-v "${PWD}/${APP_DIR}":/${APP_DIR} \
-e VENV_DIR=/${VENV_DIR} \
--entrypoint=/resources/venv.sh \
${IMAGE_RUNTIME} pytest -v
clean-cache: ## Remove python cache files: make clean-cache
@sudo sh -c 'find . | grep -E "(__pycache__|\.pyc|\.pyo$|.pytest_cache)" | xargs rm -rf'
## HELP TARGET ##
help:
@printf "\033[31m%-22s %-59s %s\033[0m\n" "Target" " Help" "Usage"; \
printf "\033[31m%-22s %-59s %s\033[0m\n" "------" " ----" "-----"; \
grep -hE '^\S+:.*## .*$$' $(MAKEFILE_LIST) | sed -e 's/:.*##\s*/:/' | sort | awk 'BEGIN {FS = ":"}; {printf "\033[32m%-22s\033[0m %-58s \033[34m%s\033[0m\n", $$1, $$2, $$3}'