feat: helper subroutines to spin up docker DB container in make

This commit is contained in:
Aravinth Manivannan 2023-07-02 00:18:24 +05:30
parent 8e0e94f98b
commit 0dc74c1c05
Signed by: realaravinth
GPG key ID: F8F50389936984FF

View file

@ -1,3 +1,15 @@
define deploy_dependencies
@-docker create --name ${db} \
-e POSTGRES_PASSWORD=password \
-p 5433:5432 \
postgres
docker start ${db}
endef
define run_migrations
cargo run --bin tests-migrate
endef
default: frontend ## Debug build
cargo build
@ -19,6 +31,20 @@ dev-env: ## Download development dependencies
cargo fetch
yarn install
env.db.recreate: ## Deploy dependencies
@-docker rm -f ${db}
$(call deploy_dependencies)
sleep 5
$(call run_migrations)
env.db: ## Deploy dependencies
$(call deploy_dependencies)
sleep 5
$(call run_migrations)
doc: ## Prepare documentation
cargo doc --no-deps --workspace --all-features
@ -43,7 +69,7 @@ lint: ## Lint codebase
yarn lint
migrate: ## Run database migrations
cargo run --bin tests-migrate
$(call run_migrations)
release: frontend ## Release build
cargo build --release