version: "3"
 
services:
  apollo-configservice:                                         ##容器服务名
    container_name: apollo-configservice                        ##容器名
    build: apollo-configservice/src/main/docker/                ##Dockerfile路径
    image: apollo-configservice:1.1.0                           ##镜像名
    network_mode: host                                          ##网络设置
    ports:
      - "8080:8080"
    volumes:
      - "/docker/apollo/logs/100003171:/opt/logs/100003171"    ##将/opt/logs/100003171目录挂载到宿主机的/docker/apollo/logs/100003171方便在宿主机上查看日志
    environment:
      - spring_datasource_url=jdbc:mysql://192.168.23.138:3306/ApolloConfigDB?characterEncoding=utf8
      - spring_datasource_username=root
      - spring_datasource_password=root
	  - eureka_instance_ip_address=192.168.23.138
 
  apollo-adminservice:
    container_name: apollo-adminservice
    build: apollo-adminservice/src/main/docker/
    image: apollo-adminservice:1.1.0
    network_mode: host
    #net: "host"
    ports:
      - "8090:8090"
    depends_on:
      - apollo-configservice
    volumes:
      - "/docker/apollo/logs/100003172:/opt/logs/100003172"
    environment:
      - spring_datasource_url=jdbc:mysql://192.168.23.138:3306/ApolloConfigDB?characterEncoding=utf8
      - spring_datasource_username=root
      - spring_datasource_password=root
	  - eureka_instance_ip_address=192.168.23.138
 
  apollo-portal:
    container_name: apollo-portal
    build: apollo-portal/src/main/docker/ 
    image: apollo-portal:1.1.0
    network_mode: host
    #net: "host"
    ports:
      - "8070:8070"
    depends_on:
      - apollo-adminservice
    volumes:
      - "/docker/apollo/logs/100003173:/opt/logs/100003173"
    environment:
      - spring_datasource_url=jdbc:mysql://192.168.23.138:3306/ApolloPortalDB?characterEncoding=utf8
      - spring_datasource_username=root
      - spring_datasource_password=root
      - apollo_portal_envs=dev                         ##指定apollo dev环境，多个环境以逗号分隔
      - dev_meta=http://192.168.23.138:8080  ##dev环境meta-server地址，即eureka地址
   mysql-5.7:
     image: "docker.io/mysql:5.7"
     container_name: mysql5.7
     restart: always
     environment:
        MYSQL_ROOT_PASSWORD: "root"
        MYSQL_USER: 'czbk'
        MYSQL_PASS: 'czbk'
     volumes:
        - "/home/apollo/apollo-master/scripts/sql:/sql"
     ports:
        - "3306:3306"
 
