services:
  mysql-de:
    image: mysql:8.4
    container_name: mysql-de
    environment:
      MYSQL_ROOT_PASSWORD: Password123@mysql
      MYSQL_DATABASE: dataease
    volumes:
      - ./my.cnf:/etc/mysql/conf.d/my.cnf
      - ./mysql-init:/docker-entrypoint-initdb.d
    healthcheck:
      test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-uroot", "-pPassword123@mysql"]
      interval: 5s
      timeout: 3s
      retries: 10
    networks:
      - de-net

  dataease:
    image: registry.cn-qingdao.aliyuncs.com/dataease/dataease:v2.10.21
    container_name: dataease
    ports:
      - "8100:8100"
    environment:
      SPRING_DATASOURCE_URL: jdbc:mysql://mysql-de:3306/dataease?autoReconnect=false&useUnicode=true&characterEncoding=UTF-8&characterSetResults=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
      SPRING_DATASOURCE_USERNAME: root
      SPRING_DATASOURCE_PASSWORD: Password123@mysql
      JAVA_OPTIONS: -Dfile.encoding=utf-8 -Dloader.path=/opt/apps -Dspring.config.additional-location=/opt/apps/config/
    volumes:
      - ./application.yml:/opt/apps/config/application.yml
    depends_on:
      mysql-de:
        condition: service_healthy
    networks:
      - de-net

networks:
  de-net:
