Browse Source

docker-compose脚本优化,nacos采用mysql方式自动初始化配置

pull/2345/head
zhangdaiscott 4 years ago
parent
commit
7cc54084dc
  1. 2
      jeecg-boot/db/Dockerfile
  2. 262
      jeecg-boot/db/tables_nacos.sql
  3. 33
      jeecg-boot/jeecg-cloud-module/docker-compose.yml
  4. 2
      jeecg-boot/jeecg-cloud-module/jeecg-cloud-gateway/Dockerfile
  5. 2
      jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/Dockerfile

2
jeecg-boot/db/Dockerfile

@ -6,6 +6,8 @@ ENV TZ=Asia/Shanghai
RUN ln -sf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone RUN ln -sf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
COPY ./tables_nacos.sql /docker-entrypoint-initdb.d
COPY ./jeecgboot-mysql-5.7.sql /docker-entrypoint-initdb.d COPY ./jeecgboot-mysql-5.7.sql /docker-entrypoint-initdb.d
COPY ./tables_xxl_job.sql /docker-entrypoint-initdb.d COPY ./tables_xxl_job.sql /docker-entrypoint-initdb.d

262
jeecg-boot/db/tables_nacos.sql

File diff suppressed because one or more lines are too long

33
jeecg-boot/jeecg-cloud-module/docker-compose.yml

@ -29,19 +29,34 @@ services:
jeecg-boot-nacos: jeecg-boot-nacos:
restart: always restart: always
image: nacos/nacos-server image: nacos/nacos-server:1.4.0
container_name: jeecg-boot-nacos container_name: jeecg-boot-nacos
hostname: jeecg-boot-nacos hostname: jeecg-boot-nacos
ports: ports:
- 8848:8848 - 8848:8848
depends_on:
- jeecg-boot-mysql
# volumes:
# - ./init/docker-startup.sh:/home/nacos/bin/docker-startup.sh
# - ./init/application.properties:/home/nacos/conf/application.properties
environment: environment:
MODE: standalone MODE: standalone
PREFER_HOST_MODE: hostname
SPRING_DATASOURCE_PLATFORM: mysql
MYSQL_SERVICE_HOST: jeecg-boot-mysql
MYSQL_SERVICE_PORT: 3306
MYSQL_SERVICE_USER: root
MYSQL_SERVICE_PASSWORD: root
MYSQL_SERVICE_DB_NAME: nacos
jeecg-boot-gateway: jeecg-boot-gateway:
build: build:
context: ./jeecg-cloud-gateway context: ./jeecg-cloud-gateway
ports: ports:
- 9999:9999 - 9999:9999
depends_on:
- jeecg-boot-nacos
- jeecg-boot-redis
container_name: jeecg-boot-gateway container_name: jeecg-boot-gateway
hostname: jeecg-boot-gateway hostname: jeecg-boot-gateway
@ -58,6 +73,14 @@ services:
environment: environment:
- TZ=Asia/Shanghai - TZ=Asia/Shanghai
# jeecg-boot-xxljob:
# build:
# context: ./jeecg-cloud-xxljob
# ports:
# - 9080:9080
# container_name: jeecg-boot-xxljob
# hostname: jeecg-boot-xxljob
# jeecg-boot-rabbitmq: # jeecg-boot-rabbitmq:
# # image: rabbitmq:3-management # # image: rabbitmq:3-management
# image: rabbitmq:3 # image: rabbitmq:3
@ -67,11 +90,3 @@ services:
# restart: always # restart: always
# container_name: jeecg-boot-rabbitmq # container_name: jeecg-boot-rabbitmq
# hostname: jeecg-boot-rabbitmq # hostname: jeecg-boot-rabbitmq
# jeecg-boot-xxljob:
# build:
# context: ./jeecg-cloud-xxljob
# ports:
# - 9080:9080
# container_name: jeecg-boot-xxljob
# hostname: jeecg-boot-xxljob

2
jeecg-boot/jeecg-cloud-module/jeecg-cloud-gateway/Dockerfile

@ -12,4 +12,4 @@ EXPOSE 9999
ADD ./target/jeecg-cloud-gateway-2.4.2.jar ./ ADD ./target/jeecg-cloud-gateway-2.4.2.jar ./
CMD java -Dfile.encoding=utf-8 -Djava.security.egd=file:/dev/./urandom -jar jeecg-cloud-gateway-2.4.2.jar CMD sleep 10;java -Dfile.encoding=utf-8 -Djava.security.egd=file:/dev/./urandom -jar jeecg-cloud-gateway-2.4.2.jar

2
jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/Dockerfile

@ -12,4 +12,4 @@ EXPOSE 7001
ADD ./target/jeecg-cloud-system-start-2.4.2.jar ./ ADD ./target/jeecg-cloud-system-start-2.4.2.jar ./
CMD sleep 60;java -Dfile.encoding=utf-8 -Djava.security.egd=file:/dev/./urandom -jar jeecg-cloud-system-start-2.4.2.jar CMD sleep 10;java -Dfile.encoding=utf-8 -Djava.security.egd=file:/dev/./urandom -jar jeecg-cloud-system-start-2.4.2.jar
Loading…
Cancel
Save