From 26ba1f4e1db120010bd447658b922e063acc78d0 Mon Sep 17 00:00:00 2001 From: Aravinth Manivannan Date: Sat, 18 May 2024 20:41:52 +0530 Subject: [PATCH] feat: provision dev deps using docker-compose --- Makefile | 15 ++++++--------- docker-compose-dev-deps.yml | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+), 9 deletions(-) create mode 100644 docker-compose-dev-deps.yml diff --git a/Makefile b/Makefile index 387d90d..ce60493 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,8 @@ define deploy_dependencies ## deploy dependencies - @-docker create --name ${db} \ - -e POSTGRES_PASSWORD=password \ - -p 5432:5432 \ - postgres - docker start ${db} + @-docker-compose -f ./docker-compose-dev-deps.yml \ + up -d endef - define run_migrations ## run database migrations cd utils/db-migrations/ && unset DATABASE_URL && cargo build cd utils/db-migrations/ && cargo run @@ -58,13 +54,14 @@ docker.publish: docker.build ## Build and publish docker images docker push libresolutions/vanikam:0.1.0 -env.db: ## Deploy dependencies +env: ## Deploy dependencies $(call deploy_dependencies) sleep 5 $(call run_migrations) -env.db.recreate: ## Deploy dependencies from scratch - @-docker rm -f ${db} +env.recreate: ## Deploy dependencies from scratch + @-docker-compose -f ./docker-compose-dev-deps.yml \ + down -v --remove-orphans $(call deploy_dependencies) sleep 5 $(call run_migrations) diff --git a/docker-compose-dev-deps.yml b/docker-compose-dev-deps.yml new file mode 100644 index 0000000..a1903aa --- /dev/null +++ b/docker-compose-dev-deps.yml @@ -0,0 +1,18 @@ +version: "3" + +services: + email: + image: maildev/maildev:latest + restart: always + container_name: vanigam-dash-maildev + network_mode: host + environment: + - MAILDEV_SMTP_PORT=10025 + - MAILDEV_INCOMING_USER=admin + - MAILDEV_INCOMING_PASS=password + + postgres: + image: postgres:13.2 + network_mode: host + environment: + POSTGRES_PASSWORD: password