#compose版本
version: '1.22.0'
#服务列表
services:
  mysql:
    build:
      context: .
      dockerfile: ./mysql/Dockerfile
     #容器名称
    container_name: energy-mysql
    #端口映射
    ports:
      - ${MYSQL_HOST_PORT}:3306
    environment:
#      - MYSQL_ROOT_USER=${MYSQL_ROOT_USER}
      - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
      - TZ=Asia/Shanghai

    #将mysql目录映射到本地 应根据自己所需要映射的目录进行修改
    volumes:
      - ${PARENT_WORK_DIR}/mysql-data/conf:/etc/mysql/conf.d
      #根据日志路径配置
      - ${PARENT_WORK_DIR}/mysql-data/logs:/var/log/mysql
      - ${PARENT_WORK_DIR}/mysql-data/data:/var/lib/mysql
    restart: on-failure
    networks:
      energy_net:
        ipv4_address: 172.40.0.20

#  redis:
#    image: redis
#    container_name: energy-redis
#    environment:
#      - REDIS_PASSWORD=${REDIS_PASSWORD}
#      - TZ=Asia/Shanghai
#    ports:
#      - ${REDIS_HOST_PORT}:6379
#    volumes:
#      - ${PARENT_WORK_DIR}/redis-data/data:/data
#      - ${PARENT_WORK_DIR}/redis-data/conf/redis.conf:/usr/local/etc/redis/redis.conf
#      - ${PARENT_WORK_DIR}/redis-data/logs:/logs
#    restart: on-failure
#    networks:
#      energy_net:
#        ipv4_address: 172.40.0.21
#
#  nacos:
#    image: nacos/nacos-server
#    container_name: energy-nacos
#    #如果挂载卷中指定nacos application.properties文件，则不需要指定以下环境变量
#    environment:
#      - SPRING_DATASOURCE_PLATFORM=${SPRING_DATASOURCE_PLATFORM}
#      - MYSQL_SERVICE_HOST=${MYSQL_SERVICE_HOST}
#      - MYSQL_SERVICE_DB_NAME=${MYSQL_SERVICE_DB_NAME}
#      - MYSQL_SERVICE_DB_PARAM=${MYSQL_SERVICE_DB_PARAM}
#      - MYSQL_SERVICE_USER=${MYSQL_ROOT_USER}
#      - MYSQL_SERVICE_PASSWORD=${MYSQL_ROOT_PASSWORD}
#      - MODE=${MODE}
##      - NACOS_AUTH_TOKEN=SecretKey012345678901234567890123456789012345678901234567890123456789
#    ports:
#      - "8849:8848"
#    volumes:
#      - ${PARENT_WORK_DIR}/nacos/logs:/home/nacos/logs
#    restart: on-failure
#    depends_on:
#      - mysql
#    networks:
#      energy_net:
#        ipv4_address: 172.40.0.22
#
#  xxl_job:
#    build:
#      context: .
#      dockerfile: ./xxl-job/Dockerfile
#    container_name: energy-xxl-job
#    ports:
#      - "16800:16900"
#    environment:
#      - TZ=Asia/Shanghai
##      volumes:
##        - ${PARENT_WORK_DIR}/xxl-job/conf:/data/applogs/xxl-job/conf
#    depends_on:
#      - mysql
#    restart: on-failure
#    networks:
#      energy_net:
#        ipv4_address: 172.40.0.23
#
#  minio:
#    image: minio/minio:latest
#    container_name: energy-minio
#    ports:
#      - "9000:9000"
#      - "9001:9001"
#    environment:
#      - MINIO_ROOT_USER=zgh-zn-nacos
#      - MINIO_ROOT_PASSWORD=zgh-zn-nacos-password
#    volumes:
#      - ${PARENT_WORK_DIR}/minio-data/data:/data
#    command: server  /data --console-address ":9001"
#    healthcheck:
#      test: [ "CMD", "curl", "-f", "http://localhost:9000/minio/health/live" ]
#      interval: 30s
#      timeout: 20s
#      retries: 3
#    networks:
#      energy_net:
#        ipv4_address: 172.40.0.24
#
#  #自动创建bucket
#  mc:
#    image: minio/mc:latest
#    container_name: energy-mc
#    depends_on:
#      minio:
#        condition: service_healthy
#    entrypoint: >
#      /bin/sh -c "
#      /usr/bin/mc alias set theminio http://172.40.0.24:9000 zgh-zn-nacos zgh-zn-nacos-password;
#      /usr/bin/mc mb theminio/bucket-zhzn;
#      /usr/bin/mc policy set public theminio/bucket-zhzn;
#      exit 0;
#      "
#      EOF
#    networks:
#      - energy_net
#
#  energy-admin:
#    # 指定构建文件
#    build:
#      context: .
#      # dockerfile文件所在路径
#      dockerfile: ./app/Dockerfile
#    container_name: energy-admin
#    environment:
#      - TZ=Asia/Shanghai
#    #端口映射
#    ports:
#      - "16200:16200"
#    volumes:
#      - ${PARENT_WORK_DIR}/energy/logs:/data/app/logs
#    restart: on-failure
#    depends_on:
#      - mysql
#      - redis
#      - nacos
#      - minio
#    networks:
#      energy_net:
#        ipv4_address: 172.40.0.25
#
#  nginx:
#    build:
#      context: .
#      dockerfile: ./nginx/Dockerfile
##    image: nginx:stable-perl
#    container_name: energy-nginx
#    ports:
#      - "80:80"
#    environment:
#      - TZ=Asia/Shanghai
#    #挂载卷
#    volumes:
#      - ${PARENT_WORK_DIR}/nginx/nginx.conf:/etc/nginx/nginx.conf
#      - ${PARENT_WORK_DIR}/nginx/conf.d:/etc/nginx/conf.d
#      - ${PARENT_WORK_DIR}/nginx/logs:/etc/nginx/logs
#      - ${PARENT_WORK_DIR}/nginx/html:/usr/share/nginx/html
#      - ${PARENT_WORK_DIR}/nginx/static:/usr/share/nginx/static
#    #重启方式
#    restart: on-failure
#    networks:
#      energy_net:
#        ipv4_address: 172.40.0.26

networks:
  energy_net:
    driver: bridge
    ipam:
      config:
        - subnet: 172.40.0.0/16


