version: "3"
services:
  my-mysql:
    container_name: my-mysql
    restart: always
    image: hub.atomgit.com/amd64/mysql:5.7.43
    privileged: true
    volumes:
      # 初始化sql
      - /data/app/docker-compost/mysql/init:/docker-entrypoint-initdb.d
      - /data/app/docker-compost/mysql/data:/var/lib/mysql
      - /data/app/docker-compost/mysql/conf.d:/etc/mysql/conf.d
    ports:
      - 3306:3306
    environment:
      - TZ=Asia/Shanghai
      - MYSQL_ROOT_PASSWORD=admin123456
      - MYSQL_USER=admin
      - MYSQL_PASSWORD=admin123456
      - LANG=C.UTF-8
    healthcheck:
      test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ]
      interval: 5s
      timeout: 10s
      retries: 10


  my-nacos:
    container_name: my_nacos
    restart: always
    image: swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/nacos/nacos-server:1.2.1
    privileged: true
    #volumes:
    #  - /data/app/docker-compost/nacos:/home/nacos
    ports:
      - 18848:8848
      - 19848:9848
    environment:
     - PREFER_HOST_MODE=hostname
     - MODE=standalone
    # 使用 mysql 作为数据库
     - SPRING_DATASOURCE_PLATFORM=mysql
     - MYSQL_SERVICE_HOST=192.168.50.234
     - MYSQL_SERVICE_PORT=3306
     - MYSQL_SERVICE_DB_NAME=nacos
     - MYSQL_SERVICE_USER=root
     - MYSQL_SERVICE_PASSWORD=admin123456
    # 设置连接 mysql 的连接参数
     - MYSQL_DB_PARAM="characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&serverTimezone=Asia/Shanghai"
    depends_on:
     my-mysql:
      condition: service_healthy


  my-redis:
    container_name: my-redis
    restart: always
    image: swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/redis:6.2.6
    privileged: true
    volumes:
      - /data/app/docker-compost/redis:/data
    ports:
      - 6379:6379
    environment:
      - TZ=Asia/Shanghai
      - REDIS_PASSWORD=123456
    command: ["redis-server", "--requirepass", "redis@2024","--appendonly","yes"]


  my-xxl-job-admin:
    image: swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/xuxueli/xxl-job-admin:2.3.0
    container_name: my-xxl-job
    environment:
      PARAMS: '
        --spring.datasource.url=jdbc:mysql://192.168.50.234:3306/xxl_job?useUnicode=true&useSSL=false&allowPublicKeyRetrieval=true&characterEncoding=UTF-8&autoReconnect=true&serverTimezone=Asia/Shanghai
        --spring.datasource.username=root
        --spring.datasource.password=admin123456
        --server.servlet.context-path=/xxl-job-admin
        --xxl.job.accessToken='
    ports:
      - "18080:8080"
    depends_on:
      - my-mysql
    restart: always
    privileged: true
    volumes:
      - /data/app/docker-compost/xxl-job/logs:/data/applogs


  my-minio:
    image: swr.cn-north-4.myhuaweicloud.com/ddn-k8s/quay.io/minio/minio:RELEASE.2023-12-20T01-00-02Z
    hostname: minio
    ports:
      - 16900:9000 # api 端口
      - 16901:9001 # 控制台端口
    environment:
      - MINIO_ROOT_USER=admin
      - MINIO_ROOT_PASSWORD=admin123
    volumes:
      - /data/app/docker-compost/minio/data:/data               #映射当前目录下的data目录至容器内/data目录
      - /data/app/docker-compost/minio/config:/root/.minio/     #映射配置目录
    command: server --console-address ':9001' /data  #指定容器中的目录 /data
    privileged: true
    restart: always


  my-nginx:
    container_name: nginx
    image: hub.atomgit.com/amd64/nginx:1.25.2-perl
    restart: always
    ports:
      - 80:80
    environment:
      - TZ=Asia/Shanghai
    volumes:
      - /data/app/docker-compost/nginx/config/nginx.conf:/etc/nginx/nginx.conf
      - /data/app/docker-compost/nginx/www/:/usr/share/nginx/html/
      - /data/app/docker-compost/nginx/logs:/var/log/nginx



