# Ephemeral E2E infrastructure. Lives on its own ports so the dev DB/Redis
# (5433/6380) keep their data untouched while tests blow this one away.
#
# Bring up with: docker compose -f docker-compose.e2e.yml up -d --wait
# Tear down (and drop volumes) with: docker compose -f docker-compose.e2e.yml down -v
services:
  postgres-e2e:
    # pgvector/pgvector ships postgres:16 with the `vector` extension already
    # available. Required for the knowledge-base RAG pipeline.
    image: pgvector/pgvector:pg16
    container_name: sehat-postgres-e2e
    environment:
      POSTGRES_USER: sehat
      POSTGRES_PASSWORD: sehat_e2e
      POSTGRES_DB: sehat_e2e
    ports:
      - '5434:5432'
    healthcheck:
      test: ['CMD-SHELL', 'pg_isready -U sehat -d sehat_e2e']
      interval: 2s
      timeout: 3s
      retries: 20
    tmpfs:
      - /var/lib/postgresql/data

  redis-e2e:
    image: redis:7-alpine
    container_name: sehat-redis-e2e
    ports:
      - '6381:6379'
    healthcheck:
      test: ['CMD', 'redis-cli', 'ping']
      interval: 2s
      timeout: 3s
      retries: 20
