From 264c868173ae1830d132b01dcd5ef30d1dd09aa3 Mon Sep 17 00:00:00 2001 From: mpaster Date: Tue, 19 Aug 2025 18:32:39 +0800 Subject: [PATCH] =?UTF-8?q?docker=E9=85=8D=E7=BD=AE=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker/docker-compose.yml | 49 +++++++++++++------ docker/nacos/conf/application.properties | 4 +- docker/ruoyi/auth/dockerfile | 2 +- docker/ruoyi/gateway/dockerfile | 4 +- docker/ruoyi/modules/file/dockerfile | 2 +- docker/ruoyi/modules/gen/dockerfile | 2 +- docker/ruoyi/modules/job/dockerfile | 2 +- docker/ruoyi/modules/system/dockerfile | 2 +- docker/ruoyi/visual/monitor/dockerfile | 2 +- ruoyi-auth/src/main/resources/bootstrap.yml | 4 +- .../src/main/resources/bootstrap.yml | 6 +-- .../src/main/resources/bootstrap.yml | 4 +- ...fig_20250425sql => ry_config_20250425.sql} | 0 13 files changed, 52 insertions(+), 31 deletions(-) rename sql/{ry_config_20250425sql => ry_config_20250425.sql} (100%) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 5fb8da1c..fb2f38cf 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -1,12 +1,20 @@ version : '3.8' + +networks: + ruoyi-net: + driver: bridge + services: ruoyi-nacos: container_name: ruoyi-nacos - image: nacos/nacos-server + image: nacos/nacos-server:3.0.2 build: context: ./nacos environment: - MODE=standalone + - NACOS_AUTH_TOKEN=rO0ABXNyABNqYXZhLnV0aWwuQmFzZTY0dPTZ3QE+Kk1T6mN8X0YpV3kQ7ZbJ5A== + - NACOS_AUTH_IDENTITY_KEY=serverIdentity + - NACOS_AUTH_IDENTITY_VALUE=security volumes: - ./nacos/logs/:/home/nacos/logs - ./nacos/conf/application.properties:/home/nacos/conf/application.properties @@ -14,8 +22,11 @@ services: - "8848:8848" - "9848:9848" - "9849:9849" + - "8888:8080" depends_on: - ruoyi-mysql + networks: + - ruoyi-net ruoyi-mysql: container_name: ruoyi-mysql image: mysql:5.7 @@ -38,6 +49,8 @@ services: environment: MYSQL_DATABASE: 'ry-cloud' MYSQL_ROOT_PASSWORD: password + networks: + - ruoyi-net ruoyi-redis: container_name: ruoyi-redis image: redis @@ -49,6 +62,8 @@ services: - ./redis/conf/redis.conf:/home/ruoyi/redis/redis.conf - ./redis/data:/data command: redis-server /home/ruoyi/redis/redis.conf + networks: + - ruoyi-net ruoyi-nginx: container_name: ruoyi-nginx image: nginx @@ -63,8 +78,8 @@ services: - ./nginx/conf.d:/etc/nginx/conf.d depends_on: - ruoyi-gateway - links: - - ruoyi-gateway + networks: + - ruoyi-net ruoyi-gateway: container_name: ruoyi-gateway build: @@ -74,8 +89,9 @@ services: - "8080:8080" depends_on: - ruoyi-redis - links: - - ruoyi-redis + - ruoyi-nacos + networks: + - ruoyi-net ruoyi-auth: container_name: ruoyi-auth build: @@ -85,8 +101,9 @@ services: - "9200:9200" depends_on: - ruoyi-redis - links: - - ruoyi-redis + - ruoyi-nacos + networks: + - ruoyi-net ruoyi-modules-system: container_name: ruoyi-modules-system build: @@ -96,10 +113,10 @@ services: - "9201:9201" depends_on: - ruoyi-redis + - ruoyi-nacos - ruoyi-mysql - links: - - ruoyi-redis - - ruoyi-mysql + networks: + - ruoyi-net ruoyi-modules-gen: container_name: ruoyi-modules-gen build: @@ -109,8 +126,8 @@ services: - "9202:9202" depends_on: - ruoyi-mysql - links: - - ruoyi-mysql + networks: + - ruoyi-net ruoyi-modules-job: container_name: ruoyi-modules-job build: @@ -120,8 +137,8 @@ services: - "9203:9203" depends_on: - ruoyi-mysql - links: - - ruoyi-mysql + networks: + - ruoyi-net ruoyi-modules-file: container_name: ruoyi-modules-file build: @@ -131,6 +148,8 @@ services: - "9300:9300" volumes: - ./ruoyi/uploadPath:/home/ruoyi/uploadPath + networks: + - ruoyi-net ruoyi-visual-monitor: container_name: ruoyi-visual-monitor build: @@ -138,3 +157,5 @@ services: dockerfile: dockerfile ports: - "9100:9100" + networks: + - ruoyi-net diff --git a/docker/nacos/conf/application.properties b/docker/nacos/conf/application.properties index 7f2a61f2..e4b55287 100644 --- a/docker/nacos/conf/application.properties +++ b/docker/nacos/conf/application.properties @@ -22,8 +22,8 @@ nacos.security.ignore.urls=/,/error,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/ nacos.core.auth.system.type=nacos nacos.core.auth.enabled=false -nacos.core.auth.default.token.expire.seconds=18000 -nacos.core.auth.default.token.secret.key=SecretKey012345678901234567890123456789012345678901234567890123456789 +nacos.core.auth.plugin.nacos.token.expire.seconds=18000 +nacos.core.auth.plugin.nacos.token.secret.key=rO0ABXNyABNqYXZhLnV0aWwuQmFzZTY0dPTZ3QE+Kk1T6mN8X0YpV3kQ7ZbJ5A== nacos.core.auth.caching.enabled=true nacos.core.auth.enable.userAgentAuthWhite=false nacos.core.auth.server.identity.key=serverIdentity diff --git a/docker/ruoyi/auth/dockerfile b/docker/ruoyi/auth/dockerfile index 01e777f0..b487a017 100644 --- a/docker/ruoyi/auth/dockerfile +++ b/docker/ruoyi/auth/dockerfile @@ -1,5 +1,5 @@ # 基础镜像 -FROM openjdk:8-jre +FROM openjdk:17-jdk-slim # author MAINTAINER ruoyi diff --git a/docker/ruoyi/gateway/dockerfile b/docker/ruoyi/gateway/dockerfile index 016fdce7..2dc3899a 100644 --- a/docker/ruoyi/gateway/dockerfile +++ b/docker/ruoyi/gateway/dockerfile @@ -1,5 +1,5 @@ -# 基础镜像 -FROM openjdk:8-jre +# 基础镜像(openjdk:17-jdk-slim不包含验证码所需的字体) +FROM openjdk:17-jdk # author MAINTAINER ruoyi diff --git a/docker/ruoyi/modules/file/dockerfile b/docker/ruoyi/modules/file/dockerfile index 7178d134..ab178f05 100644 --- a/docker/ruoyi/modules/file/dockerfile +++ b/docker/ruoyi/modules/file/dockerfile @@ -1,5 +1,5 @@ # 基础镜像 -FROM openjdk:8-jre +FROM openjdk:17-jdk-slim # author MAINTAINER ruoyi diff --git a/docker/ruoyi/modules/gen/dockerfile b/docker/ruoyi/modules/gen/dockerfile index def260d3..2c26d874 100644 --- a/docker/ruoyi/modules/gen/dockerfile +++ b/docker/ruoyi/modules/gen/dockerfile @@ -1,5 +1,5 @@ # 基础镜像 -FROM openjdk:8-jre +FROM openjdk:17-jdk-slim # author MAINTAINER ruoyi diff --git a/docker/ruoyi/modules/job/dockerfile b/docker/ruoyi/modules/job/dockerfile index 100ecae2..037969e0 100644 --- a/docker/ruoyi/modules/job/dockerfile +++ b/docker/ruoyi/modules/job/dockerfile @@ -1,5 +1,5 @@ # 基础镜像 -FROM openjdk:8-jre +FROM openjdk:17-jdk-slim # author MAINTAINER ruoyi diff --git a/docker/ruoyi/modules/system/dockerfile b/docker/ruoyi/modules/system/dockerfile index ced23b2e..25ccc76f 100644 --- a/docker/ruoyi/modules/system/dockerfile +++ b/docker/ruoyi/modules/system/dockerfile @@ -1,5 +1,5 @@ # 基础镜像 -FROM openjdk:8-jre +FROM openjdk:17-jdk-slim # author MAINTAINER ruoyi diff --git a/docker/ruoyi/visual/monitor/dockerfile b/docker/ruoyi/visual/monitor/dockerfile index ea9370a3..aea68786 100644 --- a/docker/ruoyi/visual/monitor/dockerfile +++ b/docker/ruoyi/visual/monitor/dockerfile @@ -1,5 +1,5 @@ # 基础镜像 -FROM openjdk:8-jre +FROM openjdk:17-jdk-slim # author MAINTAINER ruoyi diff --git a/ruoyi-auth/src/main/resources/bootstrap.yml b/ruoyi-auth/src/main/resources/bootstrap.yml index f456b03c..ff13eeca 100644 --- a/ruoyi-auth/src/main/resources/bootstrap.yml +++ b/ruoyi-auth/src/main/resources/bootstrap.yml @@ -14,10 +14,10 @@ spring: nacos: discovery: # 服务注册地址 - server-addr: 127.0.0.1:8848 + server-addr: ruoyi-nacos:8848 config: # 配置中心地址 - server-addr: 127.0.0.1:8848 + server-addr: ruoyi-nacos:8848 # 配置文件格式 file-extension: yml # 共享配置 diff --git a/ruoyi-gateway/src/main/resources/bootstrap.yml b/ruoyi-gateway/src/main/resources/bootstrap.yml index b6dc98ae..5056c667 100644 --- a/ruoyi-gateway/src/main/resources/bootstrap.yml +++ b/ruoyi-gateway/src/main/resources/bootstrap.yml @@ -14,10 +14,10 @@ spring: nacos: discovery: # 服务注册地址 - server-addr: 127.0.0.1:8848 + server-addr: ruoyi-nacos:8848 config: # 配置中心地址 - server-addr: 127.0.0.1:8848 + server-addr: ruoyi-nacos:8848 # 配置文件格式 file-extension: yml # 共享配置 @@ -33,7 +33,7 @@ spring: datasource: ds1: nacos: - server-addr: 127.0.0.1:8848 + server-addr: ruoyi-nacos:8848 dataId: sentinel-ruoyi-gateway groupId: DEFAULT_GROUP data-type: json diff --git a/ruoyi-modules/ruoyi-system/src/main/resources/bootstrap.yml b/ruoyi-modules/ruoyi-system/src/main/resources/bootstrap.yml index 40ab7816..15b0384b 100644 --- a/ruoyi-modules/ruoyi-system/src/main/resources/bootstrap.yml +++ b/ruoyi-modules/ruoyi-system/src/main/resources/bootstrap.yml @@ -14,10 +14,10 @@ spring: nacos: discovery: # 服务注册地址 - server-addr: 127.0.0.1:8848 + server-addr: ruoyi-nacos:8848 config: # 配置中心地址 - server-addr: 127.0.0.1:8848 + server-addr: ruoyi-nacos:8848 # 配置文件格式 file-extension: yml # 共享配置 diff --git a/sql/ry_config_20250425sql b/sql/ry_config_20250425.sql similarity index 100% rename from sql/ry_config_20250425sql rename to sql/ry_config_20250425.sql