services:
  postgres:
    image: postgres:16-alpine
    container_name: smart-pharmacy-postgres
    environment:
      POSTGRES_DB: smart_pharmacy_hub
      POSTGRES_USER: pharmacy_admin
      POSTGRES_PASSWORD: change_me_in_production
    ports:
      - "5432:5432"
    volumes:
      - postgres_data:/var/lib/postgresql/data
      - ./postgres:/docker-entrypoint-initdb.d:ro
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U pharmacy_admin -d smart_pharmacy_hub"]
      interval: 10s
      timeout: 5s
      retries: 5

  redis:
    image: redis:7-alpine
    container_name: smart-pharmacy-redis
    command: ["redis-server", "--appendonly", "yes"]
    ports:
      - "6379:6379"
    volumes:
      - redis_data:/data

  opensearch:
    image: opensearchproject/opensearch:2.14.0
    container_name: smart-pharmacy-opensearch
    environment:
      discovery.type: single-node
      plugins.security.disabled: "true"
      OPENSEARCH_JAVA_OPTS: "-Xms512m -Xmx512m"
    ports:
      - "9200:9200"
    volumes:
      - opensearch_data:/usr/share/opensearch/data

volumes:
  postgres_data:
  redis_data:
  opensearch_data:
