Commit 7b97c644cc42a2c3b196913318bf99c1922ff877
1 parent
d999ccb2
fix: update docker file and profile
Showing
6 changed files
with
124 additions
and
19 deletions
docker-compose.yml
| 1 | version: 3.8.5 | 1 | version: 3.8.5 |
| 2 | services: | 2 | services: |
| 3 | admin-server: | 3 | admin-server: |
| 4 | - container_name: admin-server | 4 | + container_name: ruoyi-admin |
| 5 | + args: | ||
| 6 | + # 项目名称 | ||
| 7 | + server_name: ruoyi-admin | ||
| 8 | + # 环境 | ||
| 9 | + env_name: druid-uat | ||
| 5 | build: | 10 | build: |
| 6 | context: . | 11 | context: . |
| 7 | dockerfile: ./ruoyi-admin/admin-dockerfile | 12 | dockerfile: ./ruoyi-admin/admin-dockerfile |
| 8 | volumes: | 13 | volumes: |
| 9 | - /ruoyi/back/logs:/home/ruoyi/logs | 14 | - /ruoyi/back/logs:/home/ruoyi/logs |
| 10 | - /ruoyi/back/uploadPath:/home/ruoyi/uploadPath | 15 | - /ruoyi/back/uploadPath:/home/ruoyi/uploadPath |
| 16 | + depends_on: | ||
| 17 | + - redis-server | ||
| 18 | + - mysql-server | ||
| 11 | restart: on-failure | 19 | restart: on-failure |
| 12 | ports: | 20 | ports: |
| 13 | - 8080:8080 | 21 | - 8080:8080 |
| 14 | 22 | ||
| 15 | mysql-server: | 23 | mysql-server: |
| 16 | - container_name: mysql_server | 24 | + container_name: mysql-server |
| 17 | image: mysql:5.7 | 25 | image: mysql:5.7 |
| 18 | build: | 26 | build: |
| 19 | context: . | 27 | context: . |
| 20 | dockerfile: mysql-dockerfile | 28 | dockerfile: mysql-dockerfile |
| 21 | volumes: | 29 | volumes: |
| 22 | - - /ruoyi/mysql/conf.d:/etc/mysql/conf.d | ||
| 23 | - - /ruoyi/mysql/logs:/logs | 30 | + - /ruoyi/mysql/my.cnf:/etc/mysql/my.cnf |
| 24 | - /ruoyi/mysql/data:/var/lib/mysql | 31 | - /ruoyi/mysql/data:/var/lib/mysql |
| 32 | + - /ruoyi/mysql/logs/error.log:/var/log/mysql/error.log | ||
| 33 | + - /ruoyi/mysql/logs/query.log:/var/log/mysql/query.log | ||
| 25 | environment: | 34 | environment: |
| 35 | + MYSQL_DATABASE: all-in-one | ||
| 26 | MYSQL_ROOT_PASSWORD: guzijian | 36 | MYSQL_ROOT_PASSWORD: guzijian |
| 27 | - MYSQL_ROOT_HOST: '%' | ||
| 28 | TZ: Asia/Shanghai | 37 | TZ: Asia/Shanghai |
| 29 | restart: always | 38 | restart: always |
| 30 | command: | 39 | command: |
| 31 | - --character-set-server=utf8mb4 | ||
| 32 | - --collation-server=utf8mb4_general_ci | ||
| 33 | - --explicit_defaults_for_timestamp=true | ||
| 34 | - --lower_case_table_names=1 | ||
| 35 | - --max_allowed_packet=128M | ||
| 36 | - --default-authentication-plugin=caching_sha2_password | 40 | + [ |
| 41 | + 'mysqld', | ||
| 42 | + '--innodb-buffer-pool-size=80M', | ||
| 43 | + '--character-set-server=utf8mb4', | ||
| 44 | + '--collation-server=utf8mb4_unicode_ci', | ||
| 45 | + '--default-time-zone=+8:00', | ||
| 46 | + '--lower-case-table-names=1' | ||
| 47 | + ] | ||
| 37 | ports: | 48 | ports: |
| 38 | - 3306:3306 | 49 | - 3306:3306 |
| 39 | 50 | ||
| 40 | redis-server: | 51 | redis-server: |
| 41 | - container_name: redis_server | 52 | + container_name: redis-server |
| 53 | + image: redis:7 | ||
| 42 | build: | 54 | build: |
| 43 | context: . | 55 | context: . |
| 44 | dockerfile: redis-dockerfile | 56 | dockerfile: redis-dockerfile |
| 45 | - entrypoint: | ||
| 46 | volumes: | 57 | volumes: |
| 47 | - - /ruoyi/redis/redis.conf:/etc/redis/redis.conf | 58 | + - /ruoyi/redis/redis.conf:/usr/local/etc/redis/redis.conf |
| 48 | - /ruoyi/redis/data:/data | 59 | - /ruoyi/redis/data:/data |
| 49 | restart: always | 60 | restart: always |
| 50 | ports: | 61 | ports: |
mysql-dockerfile
| @@ -3,3 +3,8 @@ FROM mysql:5.7 | @@ -3,3 +3,8 @@ FROM mysql:5.7 | ||
| 3 | MAINTAINER guzijian | 3 | MAINTAINER guzijian |
| 4 | # sql文件 | 4 | # sql文件 |
| 5 | ADD ./sql/*.sql /docker-entrypoint-initdb.d/ | 5 | ADD ./sql/*.sql /docker-entrypoint-initdb.d/ |
| 6 | +# 写入配置 | ||
| 7 | +RUN echo "[mysqld]" >> /etc/mysql/my.cnf \ | ||
| 8 | + && echo "log-error=/var/log/mysql/error.log" >> /etc/mysql/my.cnf \ | ||
| 9 | + && echo "general_log_file=/var/log/mysql/query.log" >> /etc/mysql/my.cnf \ | ||
| 10 | + && echo "general_log = 1" >> /etc/mysql/my.cnf | ||
| 6 | \ No newline at end of file | 11 | \ No newline at end of file |
redis-dockerfile
| 1 | FROM redis:7 | 1 | FROM redis:7 |
| 2 | -MAINTAINER guzijian | ||
| 3 | \ No newline at end of file | 2 | \ No newline at end of file |
| 3 | +MAINTAINER guzijian | ||
| 4 | +RUN echo "requirepass guzijian" >> /usr/local/etc/redis/redis.conf | ||
| 5 | +# 设置Redis快照 | ||
| 6 | +RUN sed -i 's/^# save ""/save 900 1\nsave 300 10\nsave 60 10000/g' /usr/local/etc/redis/redis.conf | ||
| 7 | +# 确保启动时使用容器内的配置 | ||
| 8 | +CMD ["redis-server", "/usr/local/etc/redis/redis.conf"] | ||
| 4 | \ No newline at end of file | 9 | \ No newline at end of file |
ruoyi-admin/admin-dockerfile
| 1 | -FROM java:8 | 1 | +FROM openjdk:8 |
| 2 | # 作者 | 2 | # 作者 |
| 3 | MAINTAINER guzijian | 3 | MAINTAINER guzijian |
| 4 | # 获取jar包名字 | 4 | # 获取jar包名字 |
| 5 | ARG server_name | 5 | ARG server_name |
| 6 | +# 启动环境 | ||
| 7 | +ARG env_name | ||
| 6 | # 获取参数 | 8 | # 获取参数 |
| 7 | ENV jar_name = $server_name | 9 | ENV jar_name = $server_name |
| 10 | +# 获取环境 | ||
| 11 | +ENV env_file = $env_name | ||
| 8 | # 工作区 | 12 | # 工作区 |
| 9 | RUN mkdir -p "/home/docker/" | 13 | RUN mkdir -p "/home/docker/" |
| 10 | # 指定工作区 | 14 | # 指定工作区 |
| @@ -12,4 +16,4 @@ WORKDIR /home/docker/ | @@ -12,4 +16,4 @@ WORKDIR /home/docker/ | ||
| 12 | # 把jar包复制到容器内 | 16 | # 把jar包复制到容器内 |
| 13 | COPY ./*.jar /home/docker/ | 17 | COPY ./*.jar /home/docker/ |
| 14 | # 执行命令 | 18 | # 执行命令 |
| 15 | -ENTRYPOINT java -jar ${jar_name}.jar | ||
| 16 | \ No newline at end of file | 19 | \ No newline at end of file |
| 20 | +ENTRYPOINT java -jar /home/docker/${jar_name}.jar --spring.profile.active=${env_file} | ||
| 17 | \ No newline at end of file | 21 | \ No newline at end of file |
ruoyi-admin/src/main/resources/application-druid-dev.yml
| @@ -60,6 +60,46 @@ spring: | @@ -60,6 +60,46 @@ spring: | ||
| 60 | wall: | 60 | wall: |
| 61 | config: | 61 | config: |
| 62 | multi-statement-allow: true | 62 | multi-statement-allow: true |
| 63 | + # 文件上传 | ||
| 64 | + servlet: | ||
| 65 | + multipart: | ||
| 66 | + # 单个文件大小 | ||
| 67 | + max-file-size: 10MB | ||
| 68 | + # 设置总上传的文件大小 | ||
| 69 | + max-request-size: 20MB | ||
| 70 | + # 服务模块 | ||
| 71 | + devtools: | ||
| 72 | + restart: | ||
| 73 | + # 热部署开关 | ||
| 74 | + enabled: true | ||
| 75 | + # redis 配置 | ||
| 76 | + redis: | ||
| 77 | + # 地址 | ||
| 78 | + host: 121.41.83.61 | ||
| 79 | + database: 0 | ||
| 80 | + password: "guzijian" | ||
| 81 | + port: 6379 | ||
| 82 | + # 连接超时时间 | ||
| 83 | + timeout: 10s | ||
| 84 | + lettuce: | ||
| 85 | + pool: | ||
| 86 | + # 连接池中的最小空闲连接 | ||
| 87 | + min-idle: 0 | ||
| 88 | + # 连接池中的最大空闲连接 | ||
| 89 | + max-idle: 8 | ||
| 90 | + # 连接池的最大数据库连接数 | ||
| 91 | + max-active: 8 | ||
| 92 | + # #连接池最大阻塞等待时间(使用负值表示没有限制) | ||
| 93 | + max-wait: -1ms | ||
| 94 | + # token配置 | ||
| 95 | + token: | ||
| 96 | + # 令牌自定义标识 | ||
| 97 | + header: Authorization | ||
| 98 | + # 令牌密钥 | ||
| 99 | + secret: abcdefghijklmnopqrstuvwxyz | ||
| 100 | + # 令牌有效期(默认30分钟) | ||
| 101 | + expireTime: 30 | ||
| 102 | + | ||
| 63 | # 项目相关配置 | 103 | # 项目相关配置 |
| 64 | ruoyi: | 104 | ruoyi: |
| 65 | # 名称 | 105 | # 名称 |
| @@ -71,7 +111,7 @@ ruoyi: | @@ -71,7 +111,7 @@ ruoyi: | ||
| 71 | # 实例演示开关 | 111 | # 实例演示开关 |
| 72 | demoEnabled: true | 112 | demoEnabled: true |
| 73 | # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) | 113 | # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) |
| 74 | - profile: /home/ruoyi/uploadPath | 114 | + profile: /ruoyi/ruoyi/uploadPath |
| 75 | # 获取ip地址开关 | 115 | # 获取ip地址开关 |
| 76 | addressEnabled: false | 116 | addressEnabled: false |
| 77 | # 验证码类型 math 数字计算 char 字符验证 | 117 | # 验证码类型 math 数字计算 char 字符验证 |
ruoyi-admin/src/main/resources/application-druid-uat.yml
| @@ -7,7 +7,7 @@ spring: | @@ -7,7 +7,7 @@ spring: | ||
| 7 | # 主库数据源 | 7 | # 主库数据源 |
| 8 | master: | 8 | master: |
| 9 | # 测试地址 | 9 | # 测试地址 |
| 10 | - url: jdbc:mysql://localhost:3306/all-in-one?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 | 10 | + url: jdbc:mysql://1.14.107.94:3306/all-in-one?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 |
| 11 | username: root | 11 | username: root |
| 12 | password: guzijian | 12 | password: guzijian |
| 13 | # 从库数据源 | 13 | # 从库数据源 |
| @@ -60,6 +60,46 @@ spring: | @@ -60,6 +60,46 @@ spring: | ||
| 60 | wall: | 60 | wall: |
| 61 | config: | 61 | config: |
| 62 | multi-statement-allow: true | 62 | multi-statement-allow: true |
| 63 | + # 文件上传 | ||
| 64 | + servlet: | ||
| 65 | + multipart: | ||
| 66 | + # 单个文件大小 | ||
| 67 | + max-file-size: 10MB | ||
| 68 | + # 设置总上传的文件大小 | ||
| 69 | + max-request-size: 20MB | ||
| 70 | + # 服务模块 | ||
| 71 | + devtools: | ||
| 72 | + restart: | ||
| 73 | + # 热部署开关 | ||
| 74 | + enabled: true | ||
| 75 | + # redis 配置 | ||
| 76 | + redis: | ||
| 77 | + # 地址 | ||
| 78 | + host: 1.14.107.94 | ||
| 79 | + database: 0 | ||
| 80 | + password: "guzijian" | ||
| 81 | + port: 6379 | ||
| 82 | + # 连接超时时间 | ||
| 83 | + timeout: 10s | ||
| 84 | + lettuce: | ||
| 85 | + pool: | ||
| 86 | + # 连接池中的最小空闲连接 | ||
| 87 | + min-idle: 0 | ||
| 88 | + # 连接池中的最大空闲连接 | ||
| 89 | + max-idle: 8 | ||
| 90 | + # 连接池的最大数据库连接数 | ||
| 91 | + max-active: 8 | ||
| 92 | + # #连接池最大阻塞等待时间(使用负值表示没有限制) | ||
| 93 | + max-wait: -1ms | ||
| 94 | + # token配置 | ||
| 95 | + token: | ||
| 96 | + # 令牌自定义标识 | ||
| 97 | + header: Authorization | ||
| 98 | + # 令牌密钥 | ||
| 99 | + secret: abcdefghijklmnopqrstuvwxyz | ||
| 100 | + # 令牌有效期(默认30分钟) | ||
| 101 | + expireTime: 30 | ||
| 102 | + | ||
| 63 | # 项目相关配置 | 103 | # 项目相关配置 |
| 64 | ruoyi: | 104 | ruoyi: |
| 65 | # 名称 | 105 | # 名称 |