version: '3.8'

services:
  mysql:
    image: mysql:8.0.43
    container_name: kaopeilian_mysql
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: Kaopeilian2025!@#
      MYSQL_DATABASE: kaopeilian
      MYSQL_CHARACTER_SET_SERVER: utf8mb4
      MYSQL_COLLATION_SERVER: utf8mb4_unicode_ci
    ports:
      - "3306:3306"
    volumes:
      - mysql_data:/var/lib/mysql
      - ./将调用工作流-联调过半-考陪练kaopeilian_final_complete_backup_20250923_025629.sql:/docker-entrypoint-initdb.d/init.sql
      - ./mysql.cnf:/etc/mysql/conf.d/mysql.cnf
    command: --default-authentication-plugin=mysql_native_password
    networks:
      - kaopeilian_network

  # 可选：phpMyAdmin管理界面
  phpmyadmin:
    image: phpmyadmin/phpmyadmin:latest
    container_name: kaopeilian_phpmyadmin
    restart: always
    environment:
      PMA_HOST: mysql
      PMA_PORT: 3306
      PMA_USER: root
      PMA_PASSWORD: Kaopeilian2025!@#
    ports:
      - "8080:80"
    depends_on:
      - mysql
    networks:
      - kaopeilian_network

volumes:
  mysql_data:
    driver: local

networks:
  kaopeilian_network:
    driver: bridge