fix: 修复Docker部署时加密密钥持久化问题

- 在docker-compose.yml中添加.env文件映射,避免重建容器时生成新密钥
- 修改docker-entrypoint.sh,只在密钥不存在时生成新的,否则使用现有的
- 移除Dockerfile中自动复制.env的逻辑,改为运行时检查
- 更新README文档,添加重要提示说明.env文件映射的必要性
- 解决了每次重建容器导致之前加密数据无法解密的严重问题
This commit is contained in:
shaw
2025-07-24 14:53:34 +08:00
parent 36201cee6b
commit 38c68ca831
4 changed files with 29 additions and 9 deletions

View File

@@ -36,9 +36,6 @@ RUN mkdir -p logs data temp
# 🔧 预先创建配置文件
RUN if [ ! -f "/app/config/config.js" ] && [ -f "/app/config/config.example.js" ]; then \
cp /app/config/config.example.js /app/config/config.js; \
fi && \
if [ ! -f "/app/.env" ] && [ -f "/app/.env.example" ]; then \
cp /app/.env.example /app/.env; \
fi
# 🌐 暴露端口