version: '3.8'

services:
  db:
    container_name: chatbot_mysql
    build:
      context: ./mysql
      dockerfile: mysql.Dockerfile
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_USER: user
      MYSQL_PASSWORD: user
      MYSQL_DATABASE: broken_chatbot
      TZ: Asia/Tokyo
    ports:
      - "3306:3306"
    volumes:
      - mysqldb:/var/lib/mysql
      - ./mysql/logs:/var/log/mysql
    networks:
      - broken_chatbot

  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    container_name: phpmyadmin
    environment:
      PMA_HOST: db
      MYSQL_ROOT_PASSWORD: root
    ports:
      - "8080:80"
    depends_on:
      - db
    networks:
      - broken_chatbot

#  etcd:
#    container_name: milvus-etcd
#    image: quay.io/coreos/etcd:v3.5.0
#    environment:
#      - ETCD_AUTO_COMPACTION_MODE=revision
#      - ETCD_AUTO_COMPACTION_RETENTION=1000
#      - ETCD_QUOTA_BACKEND_BYTES=4294967296
#    volumes:
#      - ${DOCKER_VOLUME_DIRECTORY:-.}/volumes/etcd:/etcd
#    command: etcd -advertise-client-urls=http://127.0.0.1:2379 -listen-client-urls http://0.0.0.0:2379 --data-dir /etcd
#    networks:
#      - broken_chatbot

#  minio:
#    container_name: milvus-minio
#    image: minio/minio:RELEASE.2024-05-07T06-41-25Z
#    environment:
#      MINIO_ACCESS_KEY: minioadmin
#      MINIO_SECRET_KEY: minioadmin
#    volumes:
#      - ${DOCKER_VOLUME_DIRECTORY:-.}/volumes/minio:/minio_data
#    command: minio server /minio_data
#    healthcheck:
#      test: [ "CMD", "curl", "-f", "http://localhost:9000/minio/health/live" ]
#      interval: 30s
#      timeout: 20s
#      retries: 3
#    networks:
#      - broken_chatbot

#  milvus:
#    container_name: chatbot_milvus
#    image: milvusdb/milvus:2.4-latest
#    command: [ "milvus", "run", "standalone" ]
#    environment:
#      ETCD_ENDPOINTS: etcd:2379
#      MINIO_ADDRESS: minio:9000
#    volumes:
#      - ${DOCKER_VOLUME_DIRECTORY:-.}/volumes/milvus:/var/lib/milvus
#    ports:
#      - "19530:19530"
#    depends_on:
#      - "etcd"
#      - "minio"
#    networks:
#      - broken_chatbot

#  attu:
#    container_name: chatbot_milvus_ui
#    image: zilliz/attu:v2.2.8
#    environment:
#      MILVUS_URL: chatbot_milvus:19530
#    ports:
#      - "8080:3000"
#    depends_on:
#      - "milvus"
#    networks:
#      - broken_chatbot

  web:
    container_name: chatbot_backend
    build:
      context: ./backend
      args:
        - OPENAI_API_KEY=${OPENAI_API_KEY}
      dockerfile: web.Dockerfile
    ports:
      - "8000:8000"
    depends_on:
      - db
    networks:
      - broken_chatbot

  ui:
    container_name: chatbot_frontend
    build:
      context: ./frontend
      dockerfile: frontend.Dockerfile
    networks:
      - broken_chatbot

  dummy_web:
    container_name: dummy_web
    build:
      context: ./dummy_web
      dockerfile: dummy_web.Dockerfile
    ports:
      - "8001:8001"
    networks:
      - broken_chatbot

  nginx:
    container_name: chatbot_nginx
    build:
      context: ./nginx
      dockerfile: nginx.Dockerfile
    ports:
      - "80:80"
    depends_on:
      - ui
#      - attu
    networks:
      - broken_chatbot

volumes:
  mysqldb:

networks:
  broken_chatbot:
    driver: bridge
