services: db: image: postgres:16-alpine container_name: crm_omt_db restart: unless-stopped # bind to loopback only — DB is reachable from the API on this box, not from the LAN ports: - "127.0.0.1:5432:5432" environment: # all of these MUST come from the .env file at repo root — no defaults POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?POSTGRES_PASSWORD is required} POSTGRES_DB: ${POSTGRES_DB:-crm_omt} ADMIN_EMAIL: ${ADMIN_EMAIL:?ADMIN_EMAIL is required} ADMIN_PASSWORD: ${ADMIN_PASSWORD:?ADMIN_PASSWORD is required} ADMIN_NAME: ${ADMIN_NAME:-Owner} volumes: - dbdata:/var/lib/postgresql/data - ./supabase/migrations:/sql/migrations:ro - ./server/db/init:/docker-entrypoint-initdb.d:ro healthcheck: test: ["CMD-SHELL", "pg_isready -U postgres -d crm_omt"] interval: 5s timeout: 5s retries: 20 volumes: dbdata: