-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
85 lines (69 loc) · 2.09 KB
/
Copy pathMakefile
File metadata and controls
85 lines (69 loc) · 2.09 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
DEPLOY_HOST := 93.123.95.160
SSH_PORT := 2122
APP_PORT := 5041
DOCKER_TAG := latest
DOCKER_IMAGE := diunovidov_plates
DVC_REMOTE_NAME := dvc_models_plates
USERNAME := dmitriy
.PHONY: run_app
run_app:
python3 -m uvicorn app:create_app --host='0.0.0.0' --port=$(APP_PORT)
.PHONY: install
install:
pip install -r requirements.txt
.PHONY: install_dvc
install_dvc:
pip install 'dvc[ssh]==3.33.2'
pip install 'asyncssh==2.17.0'
.PHONY: init_dvc
init_dvc:
dvc init --no-scm -f
dvc remote add --default $(DVC_REMOTE_NAME) ssh://$(DEPLOY_HOST):$(SSH_PORT)/home/$(USERNAME)/$(DVC_REMOTE_NAME)
dvc remote modify $(DVC_REMOTE_NAME) user $(USERNAME)
dvc config cache.type hardlink,symlink
.PHONY: download_model
download_model:
dvc remote modify --local $(DVC_REMOTE_NAME) keyfile ~/.ssh/gitlab_cicd
dvc pull -v
.PHONY: download_model_manual
download_model_manual:
#dvc remote modify --local $(DVC_REMOTE_NAME) ask_passphrase true
dvc pull
.PHONY: run_unit_tests
run_unit_tests:
PYTHONPATH=. pytest tests/unit/
.PHONY: run_integration_tests
run_integration_tests:
PYTHONPATH=. pytest tests/integration/
.PHONY: run_all_tests
run_all_tests:
make run_unit_tests
make run_integration_tests
.PHONY: generate_coverage_report
generate_coverage_report:
PYTHONPATH=. pytest --cov=src --cov-report html tests/
.PHONY: lint
lint:
PYTHONPATH=. tox
.PHONY: build
build:
docker build -f Dockerfile . -t $(DOCKER_IMAGE):$(DOCKER_TAG)
.PHONY: deploy
deploy:
ansible-playbook -i deploy/ansible/inventory.ini deploy/ansible/deploy.yml \
-e host=$(DEPLOY_HOST) \
-e docker_image=$(DOCKER_IMAGE) \
-e docker_tag=$(DOCKER_TAG) \
-e docker_registry_user=$(CI_REGISTRY_USER) \
-e docker_registry_password=$(CI_REGISTRY_PASSWORD) \
-e docker_registry=$(CI_REGISTRY) \
.PHONY: destroy
destroy:
ansible-playbook -i deploy/ansible/inventory.ini deploy/ansible/destroy.yml \
-e host=$(DEPLOY_HOST)
.PHONY: install_c_libs
install_c_libs:
apt-get update && apt-get install -y --no-install-recommends gcc ffmpeg libsm6 libxext6
.PHONY: docker_run
docker_run:
docker run -p $(APP_PORT):$(APP_PORT) -d $(DOCKER_IMAGE):$(DOCKER_TAG)