[add]: Database connection and migrations

This commit is contained in:
VivianDee
2025-03-28 08:38:32 +01:00
parent 3054b7240e
commit 65efe0573a
21 changed files with 431 additions and 19 deletions
+29 -4
View File
@@ -1,11 +1,36 @@
version: '3.8'
services:
digifi-flaska002:
db:
image: postgres:13
environment:
- POSTGRES_USER=${DATABASE_USER}
- POSTGRES_PASSWORD=${DATABASE_PASSWORD}
- POSTGRES_DB=${DATABASE_NAME}
ports:
- "${DATABASE_PORT}:${DATABASE_PORT}"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DATABASE_USER} -d ${DATABASE_NAME}"]
interval: 5s
timeout: 5s
retries: 5
digifi-bank-to-product-core:
build: .
ports:
- "4500:5000"
- "${APP_PORT:-4500}:5000"
environment:
- FLASK_APP=app.py
- FLASK_RUN_HOST=0.0.0.0
- FLASK_APP=wsgi.py
- FLASK_ENV=development
- DATABASE_URL=postgresql+psycopg2://${DATABASE_USER}:${DATABASE_PASSWORD}@db:${DATABASE_PORT}/${DATABASE_NAME}?options=-csearch_path%3Dflask_app
volumes:
- .:/app
depends_on:
db:
condition: service_healthy
restart: always
volumes:
postgres_data: