diff --git a/compose/production/redis/Dockerfile b/compose/production/redis/Dockerfile new file mode 100644 index 0000000..2bea9ed --- /dev/null +++ b/compose/production/redis/Dockerfile @@ -0,0 +1,16 @@ +FROM redis:7.0.0 + +# 设置时区 +ENV TZ=Asia/Shanghai + +# 复制自定义配置文件 +COPY ./compose/production/redis/redis.conf /usr/local/etc/redis/redis.conf + +# 复制业务相关的初始化脚本或模块(如有) +# COPY your_custom_module.so /usr/local/lib/redis/ + +# 设置工作目录 +WORKDIR /usr/local/etc/redis + +# 启动 Redis 时使用自定义配置 +CMD ["redis-server", "redis.conf"] diff --git a/compose/production/redis/redis.conf b/compose/production/redis/redis.conf new file mode 100644 index 0000000..0ff291f --- /dev/null +++ b/compose/production/redis/redis.conf @@ -0,0 +1,30 @@ +# redis.conf + +# 绑定所有网络接口(生产环境建议使用更严格的绑定策略) +bind 0.0.0.0 + +# 设置端口 +port 6379 + +# 设置持久化方式 +save 900 1 +save 300 10 +save 60 10000 + +# 启用 AOF 持久化 +appendonly yes +appendfilename "appendonly.aof" + +# 安全设置 +# requirepass your_redis_password + +# 最大内存限制 +maxmemory 2gb +maxmemory-policy allkeys-lru + +# 日志级别 +loglevel notice + +# 其他自定义配置 +# 例如,启用模块 +# loadmodule /usr/local/lib/redis/your_custom_module.so