version: '3.8' services: # PostgreSQL Database Service postgres: image: postgres:16-alpine container_name: balance-sheet-postgres restart: unless-stopped environment: POSTGRES_DB: balance_sheet_db POSTGRES_USER: postgres POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres_secure_pass_2026} ports: # Use POSTGRES_HOST_PORT (default 5433) to prevent conflicts if host port 5432 is already occupied - "${POSTGRES_HOST_PORT:-5433}:5432" volumes: - postgres_db_data:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U postgres -d balance_sheet_db"] interval: 10s timeout: 5s retries: 5 # Express + React Application Web Service balance-sheet-portal: build: context: . dockerfile: Dockerfile image: balance-sheet-portal:latest container_name: balance-sheet-portal restart: unless-stopped depends_on: postgres: condition: service_healthy port: - "7000" environment: - NODE_ENV=production - PORT=7000 - DATABASE_URL=postgresql://postgres:${POSTGRES_PASSWORD:-postgres_secure_pass_2026}@postgres:5432/balance_sheet_db - DATA_PATH=/app/data/portal-data.json volumes: - portal_data:/app/data healthcheck: test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:7000/api/health"] interval: 30s timeout: 5s retries: 3 start_period: 10s volumes: portal_data: name: balance_sheet_portal_data driver: local postgres_db_data: name: balance_sheet_postgres_data driver: local