mirror of
https://github.com/grillazz/fastapi-sqlalchemy-asyncpg.git
synced 2025-08-26 16:40:40 +03:00
refactor make
This commit is contained in:
parent
280bc6fdcd
commit
b89cf0da7c
28
Makefile
28
Makefile
@ -2,31 +2,31 @@
|
|||||||
help: ## Show this help
|
help: ## Show this help
|
||||||
@egrep -h '\s##\s' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
|
@egrep -h '\s##\s' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
|
||||||
|
|
||||||
.PHONY: build
|
.PHONY: docker-build
|
||||||
build: ## Build project with compose
|
docker-build: ## Build project with compose
|
||||||
docker-compose build
|
docker-compose build
|
||||||
|
|
||||||
.PHONY: up
|
.PHONY: docker-up
|
||||||
up: ## Run project with compose
|
docker-up: ## Run project with compose
|
||||||
docker-compose up --remove-orphans
|
docker-compose up --remove-orphans
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: docker-clean
|
||||||
clean: ## Clean Reset project containers and volumes with compose
|
docker-clean: ## Clean Reset project containers and volumes with compose
|
||||||
docker-compose down -v --remove-orphans | true
|
docker-compose down -v --remove-orphans | true
|
||||||
docker-compose rm -f | true
|
docker-compose rm -f | true
|
||||||
docker volume rm fastapi_postgres_data | true
|
docker volume rm fastapi_postgres_data | true
|
||||||
|
|
||||||
.PHONY: migrate-apply
|
.PHONY: docker-apply-db-migrations
|
||||||
migrate-apply: ## apply alembic migrations to database/schema
|
docker-apply-db-migrations: ## apply alembic migrations to database/schema
|
||||||
docker-compose run --rm app alembic upgrade head
|
docker-compose run --rm app alembic upgrade head
|
||||||
|
|
||||||
.PHONY: migrate-create
|
.PHONY: docker-create-db-migration
|
||||||
migrate-create: ## Create new alembic database migration aka database revision.
|
docker-create-db-migration: ## Create new alembic database migration aka database revision.
|
||||||
docker-compose up -d db | true
|
docker-compose up -d db | true
|
||||||
docker-compose run --no-deps app alembic revision --autogenerate -m "$(msg)"
|
docker-compose run --no-deps app alembic revision --autogenerate -m "$(msg)"
|
||||||
|
|
||||||
.PHONY: test
|
.PHONY: docker-test
|
||||||
test: ## Run project tests
|
docker-test: ## Run project tests
|
||||||
docker-compose -f docker-compose.yml -f docker-compose.test.yml run --rm app pytest
|
docker-compose -f docker-compose.yml -f docker-compose.test.yml run --rm app pytest
|
||||||
|
|
||||||
.PHONY: safety
|
.PHONY: safety
|
||||||
@ -49,8 +49,8 @@ format: ## Format project code.
|
|||||||
slim-build: ## with power of docker-slim build smaller and safer images
|
slim-build: ## with power of docker-slim build smaller and safer images
|
||||||
docker-slim build --compose-file docker-compose.yml --target-compose-svc app --dep-include-target-compose-svc-deps true --http-probe-exec app fastapi-sqlalchemy-asyncpg_app:latest
|
docker-slim build --compose-file docker-compose.yml --target-compose-svc app --dep-include-target-compose-svc-deps true --http-probe-exec app fastapi-sqlalchemy-asyncpg_app:latest
|
||||||
|
|
||||||
.PHONY: feed_db
|
.PHONY: docker-feed-database
|
||||||
feed_db: ## create database objects and insert data
|
docker-feed-database: ## create database objects and insert data
|
||||||
docker-compose exec db psql devdb user -f /home/gx/code/shakespeare_work.sql | true
|
docker-compose exec db psql devdb user -f /home/gx/code/shakespeare_work.sql | true
|
||||||
docker-compose exec db psql devdb user -f /home/gx/code/shakespeare_chapter.sql | true
|
docker-compose exec db psql devdb user -f /home/gx/code/shakespeare_chapter.sql | true
|
||||||
docker-compose exec db psql devdb user -f /home/gx/code/shakespeare_wordform.sql | true
|
docker-compose exec db psql devdb user -f /home/gx/code/shakespeare_wordform.sql | true
|
||||||
|
23
README.md
23
README.md
@ -76,26 +76,13 @@ as the fifth official annual Python Developers Survey, conducted as a collaborat
|
|||||||
### Make will help you
|
### Make will help you
|
||||||
To build , run and test and more ... use magic of make help to play with this project.
|
To build , run and test and more ... use magic of make help to play with this project.
|
||||||
```shell
|
```shell
|
||||||
make help
|
1. make docker-build
|
||||||
```
|
2. make docker-up
|
||||||
and you receive below list:
|
3. make docker-apply-db-migrations
|
||||||
```text
|
4. make docker-feed-db
|
||||||
build Build project with compose
|
|
||||||
clean Clean Reset project containers and volumes with compose
|
|
||||||
feed_db create database objects and insert data
|
|
||||||
format Format project code.
|
|
||||||
help Show this help
|
|
||||||
lint Lint project code.
|
|
||||||
migrate-apply apply alembic migrations to database/schema
|
|
||||||
migrate-create create new alembic migration
|
|
||||||
py-upgrade Upgrade project py files with pyupgrade library for python version 3.10
|
|
||||||
requirements Refresh requirements.txt from pipfile.lock
|
|
||||||
safety Check project and dependencies with safety https://github.com/pyupio/safety
|
|
||||||
slim-build with power of docker-slim build smaller and safer images
|
|
||||||
test Run project tests
|
|
||||||
up Run project with compose
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
||||||
|
|
||||||
### How to feed database
|
### How to feed database
|
||||||
|
Loading…
x
Reference in New Issue
Block a user