services:
  wfc-nacos:
    container_name: wfc-nacos
    image: nacos/nacos-server
    build:
      context: ./nacos
    environment:
      - MODE=standalone
      - NACOS_SERVER_IP=${NACOS_SERVER_IP}
      - NACOS_NAME_SPACE=${NACOS_NAME_SPACE}
    volumes:
      - ./nacos/logs/:/home/nacos/logs
      - ./nacos/conf/application.properties:/home/nacos/conf/application.properties
    ports:
      - "8848:8848"
      - "9848:9848"
      - "9849:9849"
    depends_on:
      - wfc-mysql
  wfc-mysql:
    container_name: wfc-mysql
    image: mysql:5.7
    build:
      context: ./mysql
    ports:
      - "3306:3306"
    volumes:
      - ./mysql/db:/docker-entrypoint-initdb.d  # 挂载 SQL 文件
      - ./mysql/conf:/etc/mysql/conf.d
      - ./mysql/logs:/logs
      - ./mysql/data:/var/lib/mysql
      - ./mysql/tmp:/tmp
    command: [
          'mysqld',
          '--innodb-buffer-pool-size=80M',
          '--character-set-server=utf8mb4',
          '--collation-server=utf8mb4_unicode_ci',
          '--default-time-zone=+8:00',
          '--lower-case-table-names=1'
        ]
    environment:
      MYSQL_DATABASE: 'wfc_system_db'
      MYSQL_ROOT_PASSWORD: 123456
  wfc-redis:
    container_name: wfc-redis
    image: redis
    build:
      context: ./redis
    ports:
      - "6379:6379"
    volumes:
      - ./redis/conf/redis.conf:/opt/wfc/redis/redis.conf
      - ./redis/data:/data
    command: redis-server /opt/wfc/redis/redis.conf

  wfc-gateway:
    container_name: wfc-gateway
    build:
      context: ./wfc/gateway
      dockerfile: dockerfile
    ports:
      - "8080:8080"
    volumes:
      - ./wfc/gateway/jar/wfc-gateway.jar:/opt/wfc/wfc-gateway.jar      
    depends_on:
      - wfc-redis
    links:
      - wfc-redis
    environment:      
      - NACOS_SERVER_IP=${NACOS_SERVER_IP}
      - NACOS_NAME_SPACE=${NACOS_NAME_SPACE}           
  wfc-auth:
    container_name: wfc-auth
    build:
      context: ./wfc/auth
      dockerfile: dockerfile
    ports:
      - "9200:9200"
    volumes:
      - ./wfc/auth/jar/wfc-auth.jar:/opt/wfc/wfc-auth.jar            
    depends_on:
      - wfc-redis
    links:
      - wfc-redis
    environment:      
      - NACOS_SERVER_IP=${NACOS_SERVER_IP}
      - NACOS_NAME_SPACE=${NACOS_NAME_SPACE}                
  wfc-modules-system:
    container_name: wfc-modules-system
    build:
      context: ./wfc/modules/system
      dockerfile: dockerfile
    ports:
      - "9201:9201"
    volumes:
      - ./wfc/modules/system/jar/wfc-modules-system.jar:/opt/wfc/wfc-modules-system.jar         
    depends_on:
      - wfc-redis
      - wfc-mysql
    links:
      - wfc-redis
      - wfc-mysql
    environment:      
      - NACOS_SERVER_IP=${NACOS_SERVER_IP}
      - NACOS_NAME_SPACE=${NACOS_NAME_SPACE}       
  wfc-modules-user:
    container_name: wfc-modules-user
    build:
      context: ./wfc/modules/user
      dockerfile: dockerfile
    ports:
      - "9204:9204"
    volumes:
      - ./wfc/modules/user/jar/wfc-modules-user.jar:/opt/wfc/wfc-modules-user.jar       
    depends_on:
      - wfc-redis
      - wfc-mysql
    links:
      - wfc-redis
      - wfc-mysql
    environment:      
      - NACOS_SERVER_IP=${NACOS_SERVER_IP}
      - NACOS_NAME_SPACE=${NACOS_NAME_SPACE}            
  wfc-modules-gen:
    container_name: wfc-modules-gen
    build:
      context: ./wfc/modules/gen
      dockerfile: dockerfile
    ports:
      - "9202:9202"
    volumes:
      - ./wfc/modules/gen/jar/wfc-modules-gen.jar:/opt/wfc/wfc-modules-gen.jar           
    depends_on:
      - wfc-mysql
    links:
      - wfc-mysql
    environment:      
      - NACOS_SERVER_IP=${NACOS_SERVER_IP}
      - NACOS_NAME_SPACE=${NACOS_NAME_SPACE}               
  wfc-modules-job:
    container_name: wfc-modules-job
    build:
      context: ./wfc/modules/job
      dockerfile: dockerfile
    ports:
      - "9203:9203"
    volumes:
      - ./wfc/modules/job/jar/wfc-modules-job.jar:/opt/wfc/wfc-modules-job.jar            
    depends_on:
      - wfc-mysql
    links:
      - wfc-mysql
    environment:      
      - NACOS_SERVER_IP=${NACOS_SERVER_IP}
      - NACOS_NAME_SPACE=${NACOS_NAME_SPACE}                
  wfc-modules-file:
    container_name: wfc-modules-file
    build:
      context: ./wfc/modules/file
      dockerfile: dockerfile
    ports:
      - "9300:9300"
    volumes:
      - ./wfc/modules/file/jar/wfc-modules-file.jar:/opt/wfc/wfc-modules-file.jar        
      - ./nginx/html/dist/img:/opt/wfc/upload
    environment:      
      - NACOS_SERVER_IP=${NACOS_SERVER_IP}
      - NACOS_NAME_SPACE=${NACOS_NAME_SPACE}          
  wfc-modules-payment:
    container_name: wfc-modules-payment
    build:
      context: ./wfc/modules/payment
      dockerfile: dockerfile
    ports:
      - "9306:9306"
    volumes:
      - ./wfc/modules/payment/jar/wfc-modules-payment.jar:/opt/wfc/wfc-modules-payment.jar           
    depends_on:
      - wfc-mysql
    links:
      - wfc-mysql        
    environment:      
      - NACOS_SERVER_IP=${NACOS_SERVER_IP}
      - NACOS_NAME_SPACE=${NACOS_NAME_SPACE}                     
  wfc-visual-monitor:
    container_name: wfc-visual-monitor
    build:
      context: ./wfc/visual/monitor
      dockerfile: dockerfile
    ports:
      - "9100:9100"
    volumes:
      - ./wfc/visual/monitor/jar/wfc-visual-monitor.jar:/opt/wfc/wfc-visual-monitor.jar           
    environment:      
      - NACOS_SERVER_IP=${NACOS_SERVER_IP}
      - NACOS_NAME_SPACE=${NACOS_NAME_SPACE}        
  wfc-nginx:
    container_name: wfc-nginx
    image: nginx
    build:
      context: ./nginx
    ports:
      - "80:80"
    volumes:
      - ./nginx/html/dist:/opt/wfc/portal
      - ./nginx/conf/nginx.conf:/etc/nginx/nginx.conf
      - ./nginx/logs:/var/log/nginx
      - ./nginx/conf.d:/etc/nginx/conf.d
    depends_on:
      - wfc-gateway
    links:
      - wfc-gateway
