-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
49 lines (37 loc) · 1.1 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
SHELL := /bin/bash
VENV := venv
ACTIVATE_VENV := source $(VENV)/bin/activate
docker_image := image
docker_container := container
.PHONY: all
all: clean-all deploy
.PHONY: deploy
deploy: fraud_detection/model/ml_model.dill.gz | $(VENV)
$(ACTIVATE_VENV) && bin/deploy
.PHONY: docker-image
docker-image:
docker build -t $(docker_image) .
.PHONY: docker-run
docker-run: docker-image fraud_detection/model/ml_model.dill.gz
docker run --rm -d -p 5000:5000 --name $(docker_container) $(docker_image)
.PHONY: docker-stop
docker-stop:
docker container stop $(docker_container)
.PHONY: docker-shell
docker-shell:
docker exec -it $(docker_container) bash
$(VENV): requirements.txt
rm -rf $@
python3 -m venv $@
$(ACTIVATE_VENV) && pip install -r $<
touch $@
.PHONY: model
model: fraud_detection/model/ml_model.dill.gz
fraud_detection/model/ml_model.dill.gz: fraud_detection/model/fraud_model.py | $(VENV)
$(ACTIVATE_VENV) && python -m fraud_detection.model.fraud_model
.PHONY: clean clean-all
clean:
rm -rf $(VENV)
find . | grep __pycache__ | xargs rm -rf
clean-all: clean
rm -f fraud_detection/model/ml_model.dill.gz