version: '3.8'

# 网络
networks:
  default:
    name: default-network
    external: true

services:
  nrhe-nginx:
    image: "registry.cn-chengdu.aliyuncs.com/infish/pack-comm-nginx:1.23.1"
    restart: always
    ports:
      - 8085:80
    volumes:
      - ./nginx/conf.d:/etc/nginx/conf.d
      - ./nginx/www:/usr/share/nginx/html

    depends_on:
      - nrhe-svc
      
  #bus消息中间件
  nrhe-bus:
    restart: always
    image: registry.cn-chengdu.aliyuncs.com/infish/pack-comm-bus:v1.0.0
    volumes:
      - ./config-service.yaml:/root/bus/app.yaml

    depends_on:
      - nrhe-mongo
      # - cr-redis
    ports:
      - 14222:4222

  #redis缓存
  # cr-redis:
  #   image: "redis:alpine"
  #   restart: always
  #   command:
  #     --requirepass "crzzz_x" #这一行是设置密码
  #   privileged: true
  #   ports:
  #     - 16379:6379

  nrhe-mongo:
    image: mongo:4.4.1
    restart: always
    environment:
      MONGO_INITDB_ROOT_USERNAME: root
      MONGO_INITDB_ROOT_PASSWORD: nrhe_zzzxxx
    volumes:
      - ~/nrhe-svc/data/mongo/db:/data/db
      - ~/nrhe-svc/data/mongo/log:/var/log/mongodb
    ports: 
      - 17017:27017

  nrhe-svc:
    image: registry.cn-chengdu.aliyuncs.com/infish/pack-nrhe:v1.0.0
    restart: always
    depends_on:
      - nrhe-bus
    volumes:
      - ~/nrhe-svc/data/template:/root/projects/template
    environment: 
      NATS: nats://nrhe-bus:4222
