docker-compose.yml 3.9 KB
Newer Older
Z
zhangzchen 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154
version: "2.1"
services:
  lottery-nacos:
    container_name: lottery-nacos
    image: nacos/nacos-server:v2.0.3
    build:
      context: ./nacos
      dockerfile: Dockerfile
    environment:
      - PREFER_HOST_MODE=ip 
      - MODE=standalone
      - SPRING_DATASOURCE_PLATFORM=mysql 
      - MYSQL_SERVICE_HOST=lottery-mysql 
      - MYSQL_SERVICE_PORT=3306 
      - MYSQL_SERVICE_USER=root 
      - MYSQL_SERVICE_PASSWORD=自己的密码 
      - MYSQL_SERVICE_DB_NAME=nacos_config 
      - TIME_ZONE='Asia/Shanghai' 
      - JVM_XMS=256m 
      - JVM_XMX=256m 
      - JVM_XMN=64m 
    volumes:
      - ./nacos/logs/:/home/nacos/logs
      - ./nacos/conf/application.properties:/home/nacos/conf/application.properties
    ports:
      - "8848:8848"
      - "9848:9848"
      - "9849:9849"
    depends_on:
      - lottery-mysql
    links:
      - lottery-mysql
  lottery-mysql:
    container_name: lottery-mysql
    image: mysql:5.7
    build:
      context: ./mysql
      dockerfile: Dockerfile
    ports:
      - "3306:3306"
    volumes:
      - ./mysql/conf:/etc/mysql/conf.d
      - ./mysql/logs:/logs
      - ./mysql/data:/var/lib/mysql
    command: [
      'mysqld',
      '--innodb-buffer-pool-size=80M',
      '--character-set-server=utf8mb4',
      '--collation-server=utf8mb4_bin',
      '--default-time-zone=+8:00',
      '--lower-case-table-names=1'
    ]
    environment:
      MYSQL_ROOT_PASSWORD: '自己的数据库密码 '
  lottery-redis:
    container_name: lottery-redis
    image: redis
    build:
      context: ./redis
      dockerfile: Dockerfile

    ports:
      - "6379:6379"
    volumes:
      - ./redis/conf/redis.conf:/home/lottery/redis/redis.conf
      - ./redis/data:/data
    command: redis-server /home/lottery/redis/redis.conf
  lottery-zookeeper:
    image: wurstmeister/zookeeper   ## 镜像
    container_name: lottery-zookeeper
    ports:
      - "2181:2181"                 ## 对外暴露的端口号
  lottery-kafka:
    image: wurstmeister/kafka       ## 镜像
    container_name: lottery-kafka
    volumes: 
        - /etc/localtime:/etc/localtime ## 挂载位置(kafka镜像和宿主机器之间时间保持一直)
    ports:
      - "9092:9092"
    environment:
      KAFKA_BROKER_ID: 0
      KAFKA_ZOOKEEPER_CONNECT: lottery-zookeeper:2181
      KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://lottery-kafka:9092
      KAFKA_LISTENERS: PLAINTEXT://0.0.0.0:9092 
      KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT
      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 2
    depends_on:
      - lottery-zookeeper
    links:
      - lottery-zookeeper
  
  lottery-website:
    container_name: lottery-website
    image: nginx
    build:
      context: ./website
      dockerfile: Dockerfile
    ports:
      - "80:80"
    volumes:
      - ./website/conf/nginx.conf:/etc/nginx/nginx.conf
      - ./website/logs:/var/log/nginx
      - ./website/conf.d:/etc/nginx/conf.d
      - ./website/html:/usr/share/nginx/html 
    depends_on:
      - lottery-api
    links:
      - lottery-api
  lottery-api:
    container_name: lottery-api
    build:
      context: ./lottery/api
      dockerfile: Dockerfile
    ports:
      - "9001:9001"
    depends_on:
      - lottery-redis
    links:
      - lottery-redis
  lottery-draw:
    container_name: lottery-draw
    build:
      context: ./lottery/draw
      dockerfile: Dockerfile
    ports:
      - "8083:8083"
    depends_on:
      - lottery-redis
      - lottery-mysql
      - lottery-nacos
    links:
      - lottery-redis
      - lottery-mysql
      - lottery-nacos
  lottery-erp:
    container_name: lottery-erp
    image: tomcat:8
    restart: always
    build:
      context: ./lottery/erp
      dockerfile: Dockerfile
    environment:
      - TZ="Asia/Shanghai"
    volumes:
      - ./lottery/erp/webapps:/usr/local/tomcat/webapps/ 
      - ./lottery/erp/conf/server.xml:/usr/local/tomcat/conf/server.xml
    ports:
      - "8080:8080"
    depends_on:
      - lottery-draw
    links:
      - lottery-draw