name: cloud-services
services:
  mysql:
    container_name: mysql_master
    image: mysql:8.0.33
    ports:
      - "3306:3306"
    environment:
      - MYSQL_ROOT_PASSWORD=123456
      - TZ=Asia/Shanghai
    volumes:
      # - ~/docker/docker_data/mysql/mysql_master/etc/my.cnf:/etc/my.cnf # 如果需要创建配置文件
      - ~/docker/docker_data/mysql/mysql_master/etc/mysql:/etc/mysql/conf.d
      - ~/docker/docker_data/mysql/mysql_master/data:/var/lib/mysql
      - ~/docker/docker_data/mysql/mysql_master/backup:/backup
    command:
      - "--log-bin=mysql-bin"
      - "--server-id=1"
      - "--collation-server=utf8mb4_unicode_ci"
      - "--character-set-server=utf8mb4"
      - "--lower-case-table-names=1"
    restart: always
    privileged: true
    networks:
      - cloud

  redis:
    container_name: redis_master
    image: redis:7.0.10
    ports:
      - "6379:6379"
    volumes:
      # - ~/docker/docker_data/redis_master/redis.conf:/etc/redis/redis.conf # 需要创建配置文件
      - ~/docker/docker_data/redis_master:/etc/redis # 之后要配置文件可以直接在这里创建 redis.conf
      - ~/docker/docker_data/redis_master/data:/data
    command:
      - "--appendonly yes"
      - "--daemonize no"
      - "--requirepass 123456"
      - "--tcp-keepalive 300"
    restart: always
    networks:
      - cloud

  minio:
    image: minio/minio
    container_name: minio_master
    ports:
      - "9000:9000"
      - "9090:9090"
    volumes:
      - ~/docker/docker_data/minio/data:/data
    environment:
      - MINIO_ROOT_USER=bunny
      - MINIO_ROOT_PASSWORD=02120212
    command: "server /data --console-address :9090"
    restart: always
    networks:
      - cloud

  mongodb:
    image: mongo:latest
    container_name: mongodb
    restart: always
    privileged: true
    ports:
      - "27017:27017"
    volumes:
      - ~/docker/docker_data/mongo/data:/data/db
      - ~/docker/docker_data/mongo/conf:/data/configdb
      - ~/docker/docker_data/mongo/logs:/data/log
    command: "mongod --config /data/configdb/mongod.conf"
    networks:
      - cloud

  rabbitmq:
    image: rabbitmq:management
    container_name: rabbitmq
    restart: unless-stopped
    ports:
      - "5672:5672"
      - "15672:15672"
    volumes:
      - ~/docker/docker_data/rabbitmq/data:/var/lib/rabbitmq
      - ~/docker/docker_data/rabbitmq/conf:/etc/rabbitmq
      - ~/docker/docker_data/rabbitmq/log:/var/log/rabbitmq
    environment:
      - RABBITMQ_DEFAULT_USER=admin
      - RABBITMQ_DEFAULT_PASS=admin
      - RABBITMQ_DEFAULT_VHOST=/
    networks:
      - cloud

  nacos:
    image: nacos/nacos-server:v2.4.3
    container_name: nacos
    ports:
      - "8848:8848"
      - "9848:9848"
    environment:
      - MODE=standalone
    restart: always
    networks:
      - cloud

  sentinel:
    image: bladex/sentinel-dashboard:1.8.8
    container_name: sentinel
    ports:
      - "8858:8858"
    privileged: true
    restart: always
    networks:
      - cloud

  seata-server:
    image: apache/seata-server:2.3.0.jdk21
    container_name: seata-server
    ports:
      - "8091:8091"
    restart: always
    networks:
      - cloud

networks: # 定义网络
  cloud: # 定义名为 auth 的网络
    name: cloud  # 网络名称为 auth
    driver: bridge  # 使用 bridge 驱动（默认）