version: '3.8' services: # Development database db-dev: image: postgres:16-alpine container_name: wealth-db-dev environment: POSTGRES_USER: wealth POSTGRES_PASSWORD: wealth_dev POSTGRES_DB: wealth_dev ports: - '5432:5432' volumes: - postgres_dev_data:/var/lib/postgresql/data healthcheck: test: ['CMD-SHELL', 'pg_isready -U wealth -d wealth_dev'] interval: 10s timeout: 5s retries: 5 # Staging database db-staging: image: postgres:16-alpine container_name: wealth-db-staging environment: POSTGRES_USER: wealth POSTGRES_PASSWORD: ${STAGING_DB_PASSWORD:-wealth_staging} POSTGRES_DB: wealth_staging ports: - '5433:5432' volumes: - postgres_staging_data:/var/lib/postgresql/data healthcheck: test: ['CMD-SHELL', 'pg_isready -U wealth -d wealth_staging'] interval: 10s timeout: 5s retries: 5 # Production database db-prod: image: postgres:16-alpine container_name: wealth-db-prod environment: POSTGRES_USER: wealth POSTGRES_PASSWORD: ${PROD_DB_PASSWORD:?PROD_DB_PASSWORD is required} POSTGRES_DB: wealth_prod ports: - '5434:5432' volumes: - postgres_prod_data:/var/lib/postgresql/data healthcheck: test: ['CMD-SHELL', 'pg_isready -U wealth -d wealth_prod'] interval: 10s timeout: 5s retries: 5 deploy: resources: limits: memory: 1G volumes: postgres_dev_data: postgres_staging_data: postgres_prod_data: