RuoYi-Vue-Plus/script/docker/docker-compose.yml
dhb52 ae3582c7fb feat: 优化 docker-compose.yml
1. 添加name: ruoyi-vue-plus, 去除 container_name 写死, 让容器自动命名为: ruoyi-vue-plus-xxxx-1;
2. volume宿主机地址修改相对路径,使用时可以不强制要求部署在/docker目录,同时也可以作为本地开发环境的快速部署;
3. 去除不必要的network_mode: "host",涉及到mysql,minio,redis,因为这些容器均不访问其他服务;
4. 添加restart: unless-stopped;
5. 添加.gitignore,当本地开发时,忽略生成的文件
2025-05-29 23:52:16 +08:00

157 lines
4.2 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

name: ruoyi-vue-plus
services:
mysql:
image: mysql:8.0.42
restart: unless-stopped
environment:
# 时区上海
TZ: Asia/Shanghai
# root 密码
MYSQL_ROOT_PASSWORD: root
# 初始化数据库(后续的初始化sql会在这个库执行)
MYSQL_DATABASE: ry-vue
ports:
- "3306:3306"
volumes:
# 数据挂载
- ./mysql/data/:/var/lib/mysql/
# 配置挂载
- ./mysql/conf/:/etc/mysql/conf.d/
command:
# 将mysql8.0默认密码策略 修改为 原先 策略 (mysql8.0对其默认策略做了更改 会导致密码无法匹配)
--default-authentication-plugin=mysql_native_password
--character-set-server=utf8mb4
--collation-server=utf8mb4_general_ci
--explicit_defaults_for_timestamp=true
--lower_case_table_names=1
privileged: true
nginx-web:
image: nginx:1.23.4
restart: unless-stopped
environment:
# 时区上海
TZ: Asia/Shanghai
ports:
- "80:80"
- "443:443"
volumes:
# 证书映射
- ./nginx/cert:/etc/nginx/cert
# 配置文件映射
- ./nginx/conf/nginx.conf:/etc/nginx/nginx.conf
# 页面目录
- ./nginx/html:/usr/share/nginx/html
# 日志目录
- ./nginx/log:/var/log/nginx
privileged: true
network_mode: "host"
redis:
image: redis:7.2.8
restart: unless-stopped
ports:
- "6379:6379"
environment:
# 时区上海
TZ: Asia/Shanghai
volumes:
# 配置文件
- ./redis/conf:/redis/config:rw
# 数据文件
- ./redis/data/:/redis/data/:rw
command: "redis-server /redis/config/redis.conf"
privileged: true
minio:
# minio 最后一个未阉割版本 不能再进行升级 在往上的版本功能被阉割
image: minio/minio:RELEASE.2025-04-22T22-12-26Z
restart: unless-stopped
ports:
# api 端口
- "9000:9000"
# 控制台端口
- "9001:9001"
environment:
# 时区上海
TZ: Asia/Shanghai
# 管理后台用户名
MINIO_ROOT_USER: ruoyi
# 管理后台密码最小8个字符
MINIO_ROOT_PASSWORD: ruoyi123
# https需要指定域名
#MINIO_SERVER_URL: "https://xxx.com:9000"
#MINIO_BROWSER_REDIRECT_URL: "https://xxx.com:9001"
# 开启压缩 on 开启 off 关闭
MINIO_COMPRESS: "off"
# 扩展名 .pdf,.doc 为空 所有类型均压缩
MINIO_COMPRESS_EXTENSIONS: ""
# mime 类型 application/pdf 为空 所有类型均压缩
MINIO_COMPRESS_MIME_TYPES: ""
volumes:
# 映射当前目录下的data目录至容器内/data目录
- ./minio/data:/data
# 映射配置目录
- ./minio/config:/root/.minio/
command: server --address ':9000' --console-address ':9001' /data # 指定容器中的目录 /data
privileged: true
ruoyi-server1:
image: ruoyi/ruoyi-server:5.4.0
restart: unless-stopped
environment:
# 时区上海
TZ: Asia/Shanghai
SERVER_PORT: 8080
SNAIL_PORT: 28080
volumes:
# 配置文件
- ./server1/logs/:/ruoyi/server/logs/
# skywalking 探针
# - ./skywalking/agent/:/ruoyi/skywalking/agent
privileged: true
network_mode: "host"
ruoyi-server2:
image: ruoyi/ruoyi-server:5.4.0
restart: unless-stopped
environment:
# 时区上海
TZ: Asia/Shanghai
SERVER_PORT: 8081
SNAIL_PORT: 28081
volumes:
# 配置文件
- ./server2/logs/:/ruoyi/server/logs/
# skywalking 探针
# - ./skywalking/agent/:/ruoyi/skywalking/agent
privileged: true
network_mode: "host"
ruoyi-monitor-admin:
image: ruoyi/ruoyi-monitor-admin:5.4.0
restart: unless-stopped
environment:
# 时区上海
TZ: Asia/Shanghai
volumes:
# 配置文件
- ./monitor/logs/:/ruoyi/monitor/logs
privileged: true
network_mode: "host"
ruoyi-snailjob-server:
image: ruoyi/ruoyi-snailjob-server:5.4.0
restart: unless-stopped
environment:
# 时区上海
TZ: Asia/Shanghai
ports:
- "8800:8800"
- "17888:17888"
volumes:
- ./snailjob/logs/:/ruoyi/snailjob/logs
privileged: true
network_mode: "host"