# 网络设置
networks:
  base2024-network:
    name: base2024-network
    driver: bridge

services:


  # mongodb
  mongodb:
    container_name: mongodb
    restart: always
    #    registry.cn-hangzhou.aliyuncs.com/awl/image: mongo:7.0
    image: registry.cn-hangzhou.aliyuncs.com/awl/mongo:4.4
    ports:
      - "27017:27017"
    environment:
      TZ: Asia/Shanghai
      MONGO_INITDB_ROOT_USERNAME: base2024
      MONGO_INITDB_ROOT_PASSWORD: base20241415926
      MONGO_INITDB_DATABASE: base2024
    volumes:
      - ./mongodb/data/:/data/db/:rw
      - ./mongodb/logs/:/var/log/mongodb/:rw
      - ./mongodb/backup/:/data/backup/:rw
    privileged: true
    networks:
      - base2024-network


  # redis
  redis:
    container_name: redis
    restart: always
    image: registry.cn-hangzhou.aliyuncs.com/awl/redis:7.0.5
    ports:
      # 内部端口，生产环境可以不对外暴露
      - "6379:6379"
    environment:
      # 时区上海
      TZ: Asia/Shanghai
    volumes:
      # 配置文件
      - ./redis/conf/:/redis/config/:rw
      # 数据文件
      - ./redis/data/:/redis/data/:rw
    command: "redis-server /redis/config/redis.conf"
    privileged: true
    networks:
      - base2024-network


  # 数据库
  db:
    container_name: db
    restart: always
    image: registry.cn-hangzhou.aliyuncs.com/awl/mariadb:10.6
    environment:
      # 时区上海
      TZ: Asia/Shanghai
      # 登录账号
      MARIADB_USER: base2024
      # 登录密码
      MARIADB_PASSWORD: base20241415926
      # root 密码
      MARIADB_ROOT_PASSWORD: base20241415926
      # 初始化数据库(后续的初始化sql会在这个库执行)
      MARIADB_DATABASE: base2024
    ports:
      - "3306:3306"
    volumes:
      # 数据挂载
      - ./db/data/:/var/lib/mysql/:rw
    command:
      --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
    networks:
      - base2024-network


  # minio
  minio:
    container_name: minio
    restart: always
    image: registry.cn-hangzhou.aliyuncs.com/awl/minio:RELEASE.2023-04-28T18-11-17Z
    ports:
      # api 端口
      - "9000:9000"
      # 控制台端口
      - "9001:9001"
    environment:
      # 时区上海
      TZ: Asia/Shanghai
      # 管理后台用户名
      MINIO_ROOT_USER: base2024
      # 管理后台密码，最小8个字符
      MINIO_ROOT_PASSWORD: base20241415926
      # https需要指定域名
      #MINIO_SERVER_URL: "https://xxx.com:9000"
      #MINIO_BROWSER_REDIRECT_URL: "https://xxx.com:9001"
      # 开启压缩 on 开启 off 关闭
      MINIO_COMPRESS: "no"
      # 扩展名 .pdf,.doc 为空 所有类型均压缩
      MINIO_COMPRESS_EXTENSIONS: ""
      # mime 类型 application/pdf 为空 所有类型均压缩
      MINIO_COMPRESS_MIME_TYPES: ""
    volumes:
      # 映射当前目录下的data目录至容器内/data目录
      - ./minio/data:/data
      # 映射配置目录
      - ./minio/config:/root/.minio/
    command: server --address ':9000' --console-address ':9001' /data  # 指定容器中的目录 /data
    privileged: true
    networks:
      - base2024-network


  # 主服务
  server1:
    container_name: server1
    restart: always
    image: registry.cn-hangzhou.aliyuncs.com/awl/base2024-api:0.1
    #    links:
    #      - db
    #      - redis
    #      - minio
    #      - mongodb
    ports:
      - "28080:8080"
    volumes:
      - ./server1/log/:/server/logs/:rw
      - ./server1/config/:/server/config/:rw
      - ./server1/tmp/:/server/tmp/:rw
      - ./nginx/html/upload/:/server/upload/:rw
    privileged: true
    networks:
      - base2024-network

  nginx:
    image: registry.cn-hangzhou.aliyuncs.com/awl/nginx:1.24.0
    restart: always
    container_name: nginx
    environment:
      # 时区上海
      TZ: Asia/Shanghai
    ports:
      - "80:80"

      # - "443:443"
    volumes:
      # 证书映射
      - ./nginx/cert/:/etc/nginx/cert/
      # 配置文件映射
      - ./nginx/conf/nginx.conf:/etc/nginx/nginx.conf
      # 页面目录
      - ./nginx/html/:/usr/share/nginx/html/
      # 日志目录
      - ./nginx/log/:/var/log/nginx/
    #    links:
    #      - server1
    #      - minio
    privileged: true
    #    network_mode: host
    networks:
      - base2024-network


