-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
47 lines (35 loc) · 1.08 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
# Use make to build, run, push and so on
.PHONY: all build run tag push database_run clean install run_local lint
NAME = fasrq
VERSION ?= 0.0.1
DB_HOST ?= $(shell hostname -I | cut -d' ' -f1):4001
TAG ?= wvoliveira
default: install run_api
build:
docker build -t ${NAME}:${VERSION} .
run: build
docker run --rm -p 8000:80 -e DB_HOST="${DB_HOST}" ${NAME}:${VERSION}
tag: build
docker tag ${NAME}:${VERSION} ${TAG}/${NAME}:${VERSION}
push: build tag
docker push ${TAG}/${NAME}:${VERSION}
run_database:
mkdir -p /tmp/rqlite
docker run --rm -v ${PWD}/conf:/rqlite/conf -v /tmp/rqlite/data:/rqlite/file/data -p 4001:4001 rqlite/rqlite:4.5.0 -auth /rqlite/conf/rqlite.json
clean:
rm -rfv __pycharm__
rm -rfv /tmp/rqlite/data
install:
python3 -m venv venv && \
. venv/bin/activate && \
pip3 install dep/pyrqlite && \
pip3 install dep/sqlalchemy-rqlite && \
pip3 install -r requirements.txt
run_api:
python3 -m venv venv && \
. venv/bin/activate && \
uvicorn main:app --reload
lint:
python3 -m venv venv && \
. venv/bin/activate && \
autopep8 -i main.py; pylint main.py; flake8 main.py