mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2026-02-11 10:05:41 +00:00
feat: make: deploy dependencies
This commit is contained in:
41
Makefile
41
Makefile
@@ -2,6 +2,32 @@ BUNDLE = static/cache/bundle
|
|||||||
OPENAPI = docs/openapi
|
OPENAPI = docs/openapi
|
||||||
CLEAN_UP = $(BUNDLE) src/cache_buster_data.json assets
|
CLEAN_UP = $(BUNDLE) src/cache_buster_data.json assets
|
||||||
|
|
||||||
|
define deploy_dependencies ## deploy dependencies
|
||||||
|
docker create --name ${db} \
|
||||||
|
-e POSTGRES_PASSWORD=password \
|
||||||
|
-p 5432:5432 \
|
||||||
|
postgres
|
||||||
|
docker create \
|
||||||
|
-p 3306:3306 \
|
||||||
|
--name ${mdb} \
|
||||||
|
--env MARIADB_USER=maria \
|
||||||
|
--env MARIADB_PASSWORD=password \
|
||||||
|
--env MARIADB_ROOT_PASSWORD=password \
|
||||||
|
--env MARIADB_DATABASE=maria \
|
||||||
|
mariadb:latest
|
||||||
|
docker create \
|
||||||
|
-p 6379:6379 \
|
||||||
|
--name mcaptcha-cache \
|
||||||
|
mcaptcha/cache:latest
|
||||||
|
docker start ${db}
|
||||||
|
docker start ${mdb}
|
||||||
|
docker start mcaptcha-cache
|
||||||
|
endef
|
||||||
|
|
||||||
|
define run_migrations ## run database migrations
|
||||||
|
cd db/db-migrations/ && cargo run
|
||||||
|
endef
|
||||||
|
|
||||||
define frontend_env ## install frontend deps
|
define frontend_env ## install frontend deps
|
||||||
yarn install
|
yarn install
|
||||||
cd docs/openapi && yarn install
|
cd docs/openapi && yarn install
|
||||||
@@ -54,6 +80,19 @@ env: ## Setup development environtment
|
|||||||
cargo fetch
|
cargo fetch
|
||||||
$(call frontend_env)
|
$(call frontend_env)
|
||||||
|
|
||||||
|
env.db: ## Deploy dependencies
|
||||||
|
$(call deploy_dependencies)
|
||||||
|
sleep 5
|
||||||
|
$(call run_migrations)
|
||||||
|
|
||||||
|
env.db.recreate: ## Deploy dependencies from scratch
|
||||||
|
@-docker rm -f ${db}
|
||||||
|
@-docker rm -f ${mdb}
|
||||||
|
@-docker rm -f mcaptcha-cache
|
||||||
|
$(call deploy_dependencies)
|
||||||
|
sleep 5
|
||||||
|
$(call run_migrations)
|
||||||
|
|
||||||
frontend-env: ## Install frontend deps
|
frontend-env: ## Install frontend deps
|
||||||
$(call frontend_env)
|
$(call frontend_env)
|
||||||
|
|
||||||
@@ -87,7 +126,7 @@ lint: ## Lint codebase
|
|||||||
cd $(OPENAPI)&& yarn test
|
cd $(OPENAPI)&& yarn test
|
||||||
|
|
||||||
migrate: ## Run database migrations
|
migrate: ## Run database migrations
|
||||||
cd db/db-migrations/ && cargo run
|
$(call run_migrations)
|
||||||
|
|
||||||
release: frontend ## Build app with release optimizations
|
release: frontend ## Build app with release optimizations
|
||||||
$(call cache_bust)
|
$(call cache_bust)
|
||||||
|
|||||||
Reference in New Issue
Block a user