services:
  mariadb:
    image: mariadb:11.8
    container_name: mariadb-local
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: Center#2025
      MYSQL_DATABASE: lcbp3_dev
      MYSQL_USER: admin
      MYSQL_PASSWORD: Center2025
    ports:
      - '3306:3306'
    volumes:
      - db_data:/var/lib/mysql
    networks:
      - lcbp3-net

  # Optional: phpMyAdmin สำหรับจัดการ DB ง่ายๆ
  pma:
    image: phpmyadmin
    container_name: pma-local
    environment:
      PMA_HOST: mariadb
    ports:
      - '8080:80'
    depends_on:
      - mariadb
    networks:
      - lcbp3-net

  redis:
    image: redis:7-alpine
    container_name: lcbp3-redis-local
    restart: always
    # ใช้ Command นี้เพื่อตั้ง Password
    command: redis-server --requirepass "Center2025"
    ports:
      - '6379:6379'
    volumes:
      - redis_data:/data
    networks:
      - lcbp3-net

  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:8.11.1
    container_name: lcbp3-elasticsearch
    environment:
      - discovery.type=single-node
      - xpack.security.enabled=false # ปิด security เพื่อความง่ายใน Dev (Prod ต้องเปิด)
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ports:
      - "9200:9200"
    volumes:
      - esdata:/usr/share/elasticsearch/data
    networks:
      - lcbp3-net
volumes:
  db_data:
  redis_data: # เพิ่ม Volume
  esdata:
  
networks:
  lcbp3-net:
    driver: bridge