fix: 优化应用启动配置和Docker部署设置
- 更新Dockerfile端口配置和启动路径 - 修改暴露端口从3003改为3000 - 更新健康检查端口配置 - 修正应用启动路径为dist/src/main - 增强应用启动错误处理 - 添加完整的try-catch错误处理机制 - 优化启动日志输出和错误信息 - 确保进程异常退出机制 - 完善健康检查接口类型定义 - 修复health接口返回类型注解 - 支持null返回值的类型安全
This commit is contained in:
@@ -47,9 +47,9 @@ COPY --from=build --chown=nestjs:nodejs /app/dist ./dist
|
||||
# 切换到非root用户
|
||||
USER nestjs
|
||||
# 暴露端口
|
||||
EXPOSE 3003
|
||||
EXPOSE 3000
|
||||
# 健康检查
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
|
||||
CMD wget --no-verbose --tries=1 --spider http://localhost:3003/health || exit 1
|
||||
CMD wget --no-verbose --tries=1 --spider http://localhost:3000/health || exit 1
|
||||
# 启动应用
|
||||
CMD ["node", "dist/main"]
|
||||
CMD ["node", "dist/src/main"]
|
||||
|
||||
Reference in New Issue
Block a user