feat: helper subroutines to spin up docker DB container in make
This commit is contained in:
parent
8e0e94f98b
commit
0dc74c1c05
28
Makefile
28
Makefile
|
@ -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
|
default: frontend ## Debug build
|
||||||
cargo build
|
cargo build
|
||||||
|
|
||||||
|
@ -19,6 +31,20 @@ dev-env: ## Download development dependencies
|
||||||
cargo fetch
|
cargo fetch
|
||||||
yarn install
|
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
|
doc: ## Prepare documentation
|
||||||
cargo doc --no-deps --workspace --all-features
|
cargo doc --no-deps --workspace --all-features
|
||||||
|
|
||||||
|
@ -43,7 +69,7 @@ lint: ## Lint codebase
|
||||||
yarn lint
|
yarn lint
|
||||||
|
|
||||||
migrate: ## Run database migrations
|
migrate: ## Run database migrations
|
||||||
cargo run --bin tests-migrate
|
$(call run_migrations)
|
||||||
|
|
||||||
release: frontend ## Release build
|
release: frontend ## Release build
|
||||||
cargo build --release
|
cargo build --release
|
||||||
|
|
Loading…
Reference in a new issue