-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
42 lines (29 loc) · 1.18 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
#!/bin/bash
OS := $(shell uname)
DOCKER_BE = fastapi-shopping-server
UID = $(shell id -u)
help: ## Show this help message
@echo 'usage: make [target]'
@echo
@echo 'targets:'
@egrep '^(.+)\:\ ##\ (.+)' ${MAKEFILE_LIST} | column -t -c 2 -s ':#'
build: ## Rebuilds all the containers
U_ID=${UID} docker-compose up --build -d
run: ## Start the containers
U_ID=${UID} docker-compose up -d
stop: ## Stop the containers
U_ID=${UID} docker-compose stop
ssh-be: ## ssh's into the be container
U_ID=${UID} docker exec -it ${DOCKER_BE} bash
db-login: # logs into the PostreSQL server
U_ID=${UID} docker-compose exec db psql -h localhost -U postgres --dbname=postgres
upgrade-db: ## runs migrations, use with precaution
U_ID=${UID} docker exec -it ${DOCKER_BE} alembic upgrade head
downgrade-db: ## removes migrations, use with precaution
U_ID=${UID} docker exec -it ${DOCKER_BE} alembic downgrade base
be-logs: # Shows the containers logs
U_ID=${UID} docker-compose logs --follow
tests: # Runs existent tests
U_ID=${UID} docker exec -it ${DOCKER_BE} pytest -v
pep: # Runs PEP8 Style standards
U_ID=${UID} docker exec -it ${DOCKER_BE} autopep8 . --recursive --in-place --pep8-passes 2000 --verbose