services:
  postgres:
    image: docker.m.daocloud.io/pgvector/pgvector:pg16
    container_name: pharmacopoeia-pg
    environment:
      POSTGRES_DB: ${POSTGRES_DB:-pharmacopoeia}
      POSTGRES_USER: ${POSTGRES_USER:-postgres}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
    ports:
      - "5432:5432"
    volumes:
      - pgdata:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-postgres}"]
      interval: 10s
      timeout: 5s
      retries: 5

  redis:
    image: docker.m.daocloud.io/library/redis:7-alpine
    container_name: pharmacopoeia-redis
    ports:
      - "6379:6379"
    volumes:
      - redisdata:/data
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 10s
      timeout: 5s
      retries: 5

volumes:
  pgdata:
  redisdata:
