diff --git a/Makefile b/Makefile index a2a7038..59e6b5a 100644 --- a/Makefile +++ b/Makefile @@ -2,31 +2,31 @@ help: ## Show this help @egrep -h '\s##\s' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' -.PHONY: build -build: ## Build project with compose +.PHONY: docker-build +docker-build: ## Build project with compose docker-compose build -.PHONY: up -up: ## Run project with compose +.PHONY: docker-up +docker-up: ## Run project with compose docker-compose up --remove-orphans -.PHONY: clean -clean: ## Clean Reset project containers and volumes with compose +.PHONY: docker-clean +docker-clean: ## Clean Reset project containers and volumes with compose docker-compose down -v --remove-orphans | true docker-compose rm -f | true docker volume rm fastapi_postgres_data | true -.PHONY: migrate-apply -migrate-apply: ## apply alembic migrations to database/schema +.PHONY: docker-apply-db-migrations +docker-apply-db-migrations: ## apply alembic migrations to database/schema docker-compose run --rm app alembic upgrade head -.PHONY: migrate-create -migrate-create: ## Create new alembic database migration aka database revision. +.PHONY: docker-create-db-migration +docker-create-db-migration: ## Create new alembic database migration aka database revision. docker-compose up -d db | true docker-compose run --no-deps app alembic revision --autogenerate -m "$(msg)" -.PHONY: test -test: ## Run project tests +.PHONY: docker-test +docker-test: ## Run project tests docker-compose -f docker-compose.yml -f docker-compose.test.yml run --rm app pytest .PHONY: safety @@ -49,8 +49,8 @@ format: ## Format project code. 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 -.PHONY: feed_db -feed_db: ## create database objects and insert data +.PHONY: docker-feed-database +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_chapter.sql | true docker-compose exec db psql devdb user -f /home/gx/code/shakespeare_wordform.sql | true diff --git a/README.md b/README.md index c4c94c1..f086f6f 100644 --- a/README.md +++ b/README.md @@ -76,26 +76,13 @@ as the fifth official annual Python Developers Survey, conducted as a collaborat ### Make will help you To build , run and test and more ... use magic of make help to play with this project. ```shell -make help -``` -and you receive below list: -```text -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 +1. make docker-build +2. make docker-up +3. make docker-apply-db-migrations +4. make docker-feed-db ``` +
### How to feed database