name: dw-clinic services: db: image: postgres:18 environment: POSTGRES_USER: clinic POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-clinic} POSTGRES_DB: clinic volumes: - clinic-data:/var/lib/postgresql - ./db:/docker-entrypoint-initdb.d:ro ports: - "15850:5432" healthcheck: test: ["CMD-SHELL", "pg_isready -U clinic -d clinic"] interval: 5s timeout: 3s retries: 10 api: build: . environment: ConnectionStrings__Clinic: Host=db;Port=5432;Database=clinic;Username=clinic;Password=${POSTGRES_PASSWORD:-clinic} ports: - "15851:8080" depends_on: db: condition: service_healthy # Optional: starts only when the profile is enabled (docker compose --profile tools up -d). tools: image: alpine profiles: ["tools"] command: sleep 300 volumes: clinic-data: