version: '3'

services:
  mysql:
    image: mysql:8.0.27
    container_name: mysql
    environment:
      # 时区上海
      TZ: Asia/Shanghai
      # root 密码
      MYSQL_ROOT_PASSWORD: ruoyi123
      # 初始化数据库
      MYSQL_DATABASE: ry-cloud
    ports:
      - "3306:3306"
    volumes:
      # 数据挂载
      - /docker/mysql/data/:/var/lib/mysql/
      # 配置挂载
      - /docker/mysql/conf/:/etc/mysql/conf.d/
    command:
      # 将mysql8.0默认密码策略 修改为 原先 策略 (mysql8.0对其默认策略做了更改 会导致密码无法匹配)
      --default-authentication-plugin=mysql_native_password
      --character-set-server=utf8mb4
      --collation-server=utf8mb4_general_ci
      --explicit_defaults_for_timestamp=true
      --lower_case_table_names=1
    privileged: true
    restart: always
    networks:
      ruoyi_net:
        ipv4_address: 172.30.0.36

  nacos:
    image: nacos/nacos-server:v2.0.4
    container_name: nacos
    ports:
      - "8848:8848"
      - "9848:9848"
      - "9849:9849"
    environment:
      TZ: Asia/Shanghai
      MODE: standalone
      SPRING_DATASOURCE_PLATFORM: mysql
      MYSQL_SERVICE_HOST: 172.30.0.36
      MYSQL_SERVICE_PORT: 3306
      MYSQL_SERVICE_USER: root
      MYSQL_SERVICE_PASSWORD: ruoyi123
      MYSQL_SERVICE_DB_NAME: ry-config
      MYSQL_SERVICE_DB_PARAM: characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
    volumes:
      - /docker/nacos/logs/:/home/nacos/logs
      - /docker/nacos/config/custom.properties:/home/nacos/init.d/custom.properties
    privileged: true
    restart: always
    networks:
      ruoyi_net:
        ipv4_address: 172.30.0.40

  redis:
    image: redis:6.2.6
    container_name: redis
    ports:
      - "6379:6379"
    environment:
      # 时区上海
      TZ: Asia/Shanghai
    volumes:
      # 配置文件
      - /docker/redis/conf:/redis/config
      # 数据文件
      - /docker/redis/data/:/redis/data/
    command: "redis-server /redis/config/redis.conf"
    privileged: true
    restart: always
    networks:
      ruoyi_net:
        ipv4_address: 172.30.0.48

  minio:
    image: minio/minio:RELEASE.2021-10-27T16-29-42Z
    container_name: minio
    ports:
      # api 端口
      - "9000:9000"
      # 控制台端口
      - "9001:9001"
    environment:
      # 时区上海
      TZ: Asia/Shanghai
      # 管理后台用户名
      MINIO_ACCESS_KEY: ruoyi
      # 管理后台密码，最小8个字符
      MINIO_SECRET_KEY: ruoyi123
      # https需要指定域名
      MINIO_SERVER_URL: ""
      # 开启压缩 on 开启 off 关闭
      MINIO_COMPRESS: "off"
      # 扩展名 .pdf,.doc 为空 所有类型均压缩
      MINIO_COMPRESS_EXTENSIONS: ""
      # mime 类型 application/pdf 为空 所有类型均压缩
      MINIO_COMPRESS_MIME_TYPES: ""
    volumes:
      # 映射当前目录下的data目录至容器内/data目录
      - /docker/minio/data:/data
      # 映射配置目录
      - /docker/minio/config:/root/.minio/
    command: server --address ':9000' --console-address ':9001' /data  # 指定容器中的目录 /data
    privileged: true
    restart: always
    networks:
      ruoyi_net:
        ipv4_address: 172.30.0.54

  seata-server:
    image: seataio/seata-server:1.4.2
    container_name: seata-server
    ports:
      - "8091:8091"
    environment:
      TZ: Asia/Shanghai
      # 注意 此处ip如果是外网使用 要改为外网ip
      SEATA_IP: 172.30.0.58
      SEATA_PORT: 8091
      STORE_MODE: db
      SEATA_CONFIG_NAME: file:/root/seata-config/registry
    volumes:
      - /docker/seata/config:/root/seata-config
    privileged: true
    restart: always
    networks:
      ruoyi_net:
        ipv4_address: 172.30.0.58

  nginx-web:
    image: nginx:1.21.3
    container_name: nginx-web
    environment:
      # 时区上海
      TZ: Asia/Shanghai
    ports:
      - "80:80"
      - "443:443"
    volumes:
      # 证书映射
      - /docker/nginx/cert:/etc/nginx/cert
      # 配置文件映射
      - /docker/nginx/conf/nginx.conf:/etc/nginx/nginx.conf
      # 页面目录
      - /docker/nginx/html:/usr/share/nginx/html
      # 日志目录
      - /docker/nginx/log:/var/log/nginx
    privileged: true
    restart: always
    networks:
      - ruoyi_net

  sentinel:
    image: ruoyi/ruoyi-sentinel-dashboard:0.11.0
    container_name: sentinel
    environment:
      TZ: Asia/Shanghai
    ports:
      - "8718:8718"
    volumes:
      # 配置文件
      - /docker/ruoyi-sentinel-dashboard/logs/:/ruoyi/sentinel-dashboard/logs
    restart: always
    networks:
      ruoyi_net:
        ipv4_address: 172.30.0.68

  ruoyi-monitor-admin:
    image: ruoyi/ruoyi-monitor:0.11.0
    container_name: ruoyi-monitor
    environment:
      # 时区上海
      TZ: Asia/Shanghai
    ports:
      - "9100:9100"
    volumes:
      # 配置文件
      - /docker/ruoyi-monitor/logs/:/ruoyi/monitor/logs
    privileged: true
    restart: always
    networks:
      ruoyi_net:
        ipv4_address: 172.30.0.90

  ruoyi-xxl-job-admin:
    image: ruoyi/ruoyi-xxl-job-admin:0.11.0
    container_name: ruoyi-xxl-job-admin
    environment:
      # 时区上海
      TZ: Asia/Shanghai
    ports:
      - "9900:9900"
    volumes:
      # 配置文件
      - /docker/ruoyi-xxl-job-admin/logs/:/ruoyi/xxl-job-admin/logs
    privileged: true
    restart: always
    networks:
      ruoyi_net:
        ipv4_address: 172.30.0.92

  ruoyi-gateway:
    image: ruoyi/ruoyi-gateway:0.11.0
    container_name: ruoyi-gateway
    environment:
      # 时区上海
      TZ: Asia/Shanghai
    ports:
      - "8080:8080"
    volumes:
      # 配置文件
      - /docker/ruoyi-gateway/logs/:/ruoyi/gateway/logs
    privileged: true
    restart: always
    networks:
      ruoyi_net:
        ipv4_address: 172.30.0.100

  ruoyi-auth:
    image: ruoyi/ruoyi-auth:0.11.0
    container_name: ruoyi-auth
    environment:
      # 时区上海
      TZ: Asia/Shanghai
    ports:
      - "9200:9200"
    volumes:
      # 配置文件
      - /docker/ruoyi-auth/logs/:/ruoyi/auth/logs
    privileged: true
    restart: always
    networks:
      ruoyi_net:
        ipv4_address: 172.30.0.110

  ruoyi-system:
    image: ruoyi/ruoyi-system:0.11.0
    container_name: ruoyi-system
    environment:
      # 时区上海
      TZ: Asia/Shanghai
    ports:
      - "9201:9201"
    volumes:
      # 配置文件
      - /docker/ruoyi-system/logs/:/ruoyi/system/logs
    privileged: true
    restart: always
    networks:
      - ruoyi_net

  ruoyi-gen:
    image: ruoyi/ruoyi-gen:0.11.0
    container_name: ruoyi-gen
    environment:
      # 时区上海
      TZ: Asia/Shanghai
    ports:
      - "9202:9202"
    volumes:
      # 配置文件
      - /docker/ruoyi-gen/logs/:/ruoyi/gen/logs
    privileged: true
    restart: always
    networks:
      - ruoyi_net

  ruoyi-job:
    image: ruoyi/ruoyi-job:0.11.0
    container_name: ruoyi-job
    environment:
      # 时区上海
      TZ: Asia/Shanghai
    ports:
      - "9203:9203"
    volumes:
      # 配置文件
      - /docker/ruoyi-job/logs/:/ruoyi/job/logs
    privileged: true
    restart: always
    networks:
      - ruoyi_net

  ruoyi-resource:
    image: ruoyi/ruoyi-resource:0.11.0
    container_name: ruoyi-resource
    environment:
      # 时区上海
      TZ: Asia/Shanghai
    ports:
      - "9300:9300"
    volumes:
      # 配置文件
      - /docker/ruoyi-resource/logs/:/ruoyi/resource/logs
    privileged: true
    restart: always
    networks:
      - ruoyi_net

networks:
  ruoyi_net:
    driver: bridge
    ipam:
      config:
        - subnet: 172.30.0.0/16
