-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
54 lines (41 loc) · 1.72 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
VERSION = $$(cat VERSION)
# Docker
ENV_FOLDER=./environment
DOCKER_COMPOSE_SETTINGS = --project-name plmomo --env-file .env -f docker-compose-app.yml
DOCKER_COMPOSE_CONTAINER_NAME = plmomo_v${VERSION}
# VENV
VENV_NAME=plmomo
VENV_PATH=$(ENV_FOLDER)/$(VENV_NAME)
VENV_ACTIVATE_PATH=$(VENV_PATH)/bin/activate
REQUIREMENTS_PATH=$(ENV_FOLDER)/requirements.txt
create-env:
@echo "======================== Creating the project virtual environment ========================"
python3 -m virtualenv --system-site-packages -p python3.6 $(VENV_PATH)
. $(VENV_ACTIVATE_PATH) && \
python3 -m pip install pip --upgrade && \
python3 -m pip install -r $(REQUIREMENTS_PATH)
activate-env-command:
@echo "======================== Execute the below command in terminal ========================"
@echo source $(VENV_ACTIVATE_PATH)
docker-build:
export VERSION=${VERSION} &&\
docker-compose ${DOCKER_COMPOSE_SETTINGS} build
docker-up:
export VERSION=${VERSION} &&\
docker-compose ${DOCKER_COMPOSE_SETTINGS} up -d &&\
docker exec -it ${DOCKER_COMPOSE_CONTAINER_NAME} python manage.py migrate
docker-down:
export VERSION=${VERSION} &&\
docker-compose ${DOCKER_COMPOSE_SETTINGS} down
docker-logs:
export VERSION=${VERSION} &&\
docker-compose ${DOCKER_COMPOSE_SETTINGS} logs -f
docker-web-tests:
docker exec -it ${DOCKER_COMPOSE_CONTAINER_NAME} python manage.py test
docker-backend-tests:
docker exec -it -w /code ${DOCKER_COMPOSE_CONTAINER_NAME} python3 -m pytest backend/tests/
docker-migrate-models:
docker exec -it ${DOCKER_COMPOSE_CONTAINER_NAME} python manage.py makemigrations &&\
docker exec -it ${DOCKER_COMPOSE_CONTAINER_NAME} python manage.py migrate
docker-run-main:
docker exec -it -w /code ${DOCKER_COMPOSE_CONTAINER_NAME} python3 main.py