0%

Docker部署ES+SpringBoot+Mysql+Reids+Node.js

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
version: '2'
services:
admin:
image: node:10.16-alpine
container_name: admin
ports:
- '8081:8080'
working_dir: /www/wwwroot/admin
volumes: # 文件夹映射
- /www/wwwroot/admin:/www/wwwroot/admin # 挂载源码
- /etc/timezone:/etc/timezone #同步时区
- /etc/localtime:/etc/localtime #同步时区
command: /bin/sh -c "npm config set unsafe-perm true && npm config set registry http://registry.npm.taobao.org && npm install echarts -S && npm install webpack-dev-server -g && npm install webpack-dev-server -g && npm i && npm run dev"
networks:
- 'net'
privileged: true
restart: always

client:
image: node:10.16-alpine
container_name: client
ports:
- '8080:8080'
working_dir: /www/wwwroot/client
volumes: # 文件夹映射
- /www/wwwroot/client:/www/wwwroot/client # 挂载源码
- /etc/timezone:/etc/timezone #同步时区
- /etc/localtime:/etc/localtime #同步时区
command: /bin/sh -c "npm config set unsafe-perm true && npm config set registry http://registry.npm.taobao.org &&npm install webpack-dev-server -g && npm install webpack-dev-server -g && npm i --unsafe-perm && npm run dev"
networks:
- 'net'
privileged: true
restart: always

springboot:
image: openjdk:8-jdk-alpine
working_dir: /www/wwwroot/java
container_name: springboot
ports:
- '8088:8088'
volumes: # 容器数据卷挂载
- /www/wwwroot/java/fmall-0.0.1-SNAPSHOT.jar:/www/wwwroot/java/app.jar # 挂载源码
- /etc/timezone:/etc/timezone #同步时区
- /etc/localtime:/etc/localtime #同步时区
command: /bin/sh -c "nohup java -jar app.jar"
privileged: true
networks:
- 'net'
depends_on:
- redis
- mysql
restart: always

mysql:
image: mysql:5.7
container_name: mysql
ports:
- 3306:3306
volumes:
- ./mysql/data:/var/lib/mysql # 挂载数据目录
- ./mysql/conf:/etc/mysql/conf.d # 挂载配置文件目录
- ./mysql/logs:/var/log/mysql # 挂载配置文件目录
- ./mysql/init:/docker-entrypoint-initdb.d
privileged: 'true'
env_file:
- ./mysql/mysql.env
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
networks:
- net
restart: always

redis:
image: redis:alpine
container_name: redis
ports:
- 6379:6379
volumes:
- ./redis/data:/data
- ./redis/conf/redis.conf:/usr/local/etc/redis/redis.conf
- /etc/timezone:/etc/timezone #同步时区
- /etc/localtime:/etc/localtime #同步时区
command: redis-server /usr/local/etc/redis/redis.conf
networks:
- 'net'
restart: always

nginx:
image: nginx:alpine
container_name: nginx
ports:
- '80:80'
- '7000:7000'
- '443:443'
volumes: # 文件夹映射
- ./nginx/conf.d:/etc/nginx/conf.d # nginx站点配置文件
- /www/wwwroot:/etc/nginx/sites-available # 宿主:docker:只读 ,www目录
- ./nginx/conf/nginx.conf:/etc/nginx/nginx.conf # nginx配置文件
- ./nginx/logs:/var/log/nginx # 网站日志文件
- /etc/timezone:/etc/timezone #同步时区
- /etc/localtime:/etc/localtime #同步时间
- /www/wwwroot:/www/wwwroot
networks:
- net
depends_on:
- springboot
- admin
- client
restart: always

elasticsearch:
image: elasticsearch:7.6.1
container_name: elasticsearch
environment:
- node.name=elasticsearch
- cluster.name=es-docker-cluster
# - discovery.seed_hosts=192.168.0.1
- cluster.initial_master_nodes=elasticsearch
- bootstrap.memory_lock=true
- 'ES_JAVA_OPTS=-Xms1g -Xmx1g'
privileged: true
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- ./elasticsearch/data:/usr/share/elasticsearch/data
- ./elasticsearch/logs:/usr/share/elasticsearch/logs
- ./elasticsearch/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
- ./elasticsearch/elastic-certificates.p12:/usr/share/elasticsearch/config/elastic-certificates.p12
ports:
- 9200:9200
networks:
- net

networks:
net:
driver: bridge

相关教程:https://www.cnblogs.com/woshimrf/p/docker-es7.html

iBoy wechat
欢迎您扫一扫上面的微信公众号,订阅我的博客!