Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Dockerfile #5

Merged
merged 2 commits into from
Oct 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions compose/production/redis/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
30 changes: 30 additions & 0 deletions compose/production/redis/redis.conf
Original file line number Diff line number Diff line change
@@ -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
Loading