Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +3 -6
Dockerfile
CHANGED
|
@@ -29,12 +29,9 @@ ENV NODE_ENV=production
|
|
| 29 |
# 强行把 SQLite 数据库文件的生成位置指向你的持久化 Bucket 目录
|
| 30 |
ENV DATABASE_URL="file:/data/database.sqlite"
|
| 31 |
|
| 32 |
-
# 【关键安全机制】:生成一个随机的 32 字节密钥供它启动时用于 AES 加密
|
| 33 |
-
# 这样你就不用手动在环境变量里去配置复杂的加密序列了
|
| 34 |
-
ENV ENCRYPTION_KEY="freellmapi_secret_key_javaeeduke99"
|
| 35 |
-
|
| 36 |
# 7. 暴露端口
|
| 37 |
EXPOSE 7860
|
| 38 |
|
| 39 |
-
# 8.
|
| 40 |
-
|
|
|
|
|
|
| 29 |
# 强行把 SQLite 数据库文件的生成位置指向你的持久化 Bucket 目录
|
| 30 |
ENV DATABASE_URL="file:/data/database.sqlite"
|
| 31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
# 7. 暴露端口
|
| 33 |
EXPOSE 7860
|
| 34 |
|
| 35 |
+
# 8. 绝杀:使用内置的 node 动态生成 64 位完美的 Hex 密钥并启动服务
|
| 36 |
+
# 这完美满足了作者代码里对 64 hex chars 的死规定!
|
| 37 |
+
CMD ["sh", "-c", "export ENCRYPTION_KEY=$(node -e \"console.log(require('crypto').randomBytes(32).toString('hex'))\") && node server/dist/index.js"]
|