From 3582511ff0a431aa3f07d6ef60ec910d0a3acc01 Mon Sep 17 00:00:00 2001 From: Lucas Date: Sat, 13 Dec 2025 19:40:55 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8feature=20:=20add=20demo=20postgres=20?= =?UTF-8?q?database=20with=20Docker=20and=20URL=20inside=20.env.example?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.example | 3 +++ compose.yml | 27 ++++++++++++++++++++++++--- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/.env.example b/.env.example index a4beac8..b7a88d7 100644 --- a/.env.example +++ b/.env.example @@ -16,6 +16,9 @@ # # You can define multiple database connections below. +# Docker Demo Database +DATABASE_URL=postgresql://postgres:password@localhost:5432/db_handler_demo + # Production Database DATABASE_URL=postgresql://user:password@localhost:5432/prod_db diff --git a/compose.yml b/compose.yml index d59873e..dcb9334 100644 --- a/compose.yml +++ b/compose.yml @@ -3,8 +3,9 @@ services: image: oven/bun:latest command: bash volumes: - - .:${PWD} - working_dir: ${PWD} + - .:/app + - /app/node_modules + working_dir: /app environment: - TZ=Europe/Paris - LOG_LEVEL=trace @@ -12,4 +13,24 @@ services: - .env tty: true init: true - \ No newline at end of file + depends_on: + postgres: + condition: service_healthy + + postgres: + image: postgres:17-alpine + restart: always + environment: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: password + POSTGRES_DB: db_handler_demo + volumes: + - pg_data:/var/lib/postgresql/data + healthcheck: + test: ["CMD-SHELL", "pg_isready -U postgres"] + interval: 5s + timeout: 5s + retries: 5 + +volumes: + pg_data: