-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
87 lines (68 loc) · 2.13 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
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
86
87
.DEFAULT_GOAL := help
# Set python
export PYTHONPATH=.
python = python
.PHONY: help
help:
@echo "USAGE"
@echo " make <commands>"
@echo ""
@echo "AVAILABLE COMMANDS"
@echo " - PRODUCTION - "
@echo " install Install the dependencies"
@echo " start_chat Start the chat in interactive mode"
@echo " start_service Start the FastAPI service"
@echo " start_docker_fastapi Start the FastAPI service in docker"
@echo " start_bot Start the TG bot"
@echo " "
@echo " - DEVELOPMENT -"
@echo " lint Reformat code"
@echo " install_dev Install the dependencies for development"
# ================================================================================================
# Dependencies
# ================================================================================================
.PHONY: install
install:
$(python) -m pip install -r requirements/prod.txt
.PHONY: install_dev
install_dev:
$(python) -m pip install -r requirements/dev.txt
# ================================================================================================
# Lint
# ================================================================================================
.PHONY: black
black:
$(python) -m black --line-length 80 .
.PHONY: isort
isort:
$(python) -m isort .
.PHONY: flake
flake:
$(python) -m flake8 .
.PHONY: lint
lint: black isort flake
# ================================================================================================
# Start
# ================================================================================================
.env:
# Check if .env file exists
@echo "ERROR: You need to specify TOKENS in .env file. Read README.md for more info."
exit 1
.PHONY: start_chat
start_chat: .env
@echo "Running chat..."
$(python) src/answerer.py
.PHONY: start_service
start_service: .env
@echo "Running service..."
$(python) src/main.py
.PHONY: start_bot
start_bot: .env
@echo "Running bot..."
$(python) src/bot.py
.PHONY: start_docker_fastapi
start_docker_fastapi:
@echo "Running docker FastAPI..."
docker rm -f znayu-ai-fastapi
docker build -t znayu-ai .
docker run -d --name znayu-ai-fastapi -p 8069:8069 znayu-ai