chore: 更新Dockerfile和TypeScript配置,优化代码结构
- 将基础镜像版本从Node.js 18 Alpine更新至Node.js 22 Alpine - 修改生产阶段镜像为Node.js 22 Alpine - 在tsconfig.json中添加对Node.js类型的支持 - 在wechat.adapter.ts中优化crypto模块的导入方式
This commit is contained in:
parent
21a2865e43
commit
0bc27df560
|
|
@ -1,5 +1,5 @@
|
|||
# 使用官方 Node.js 18 Alpine 镜像作为基础镜像
|
||||
FROM node:18-alpine AS base
|
||||
# 使用官方 Node.js 22 Alpine 镜像作为基础镜像
|
||||
FROM node:22-alpine AS base
|
||||
|
||||
# 构建参数
|
||||
ARG GIT_COMMIT=""
|
||||
|
|
@ -30,7 +30,7 @@ COPY . .
|
|||
RUN npm run build
|
||||
|
||||
# 生产阶段
|
||||
FROM node:18-alpine AS production
|
||||
FROM node:22-alpine AS production
|
||||
# 设置环境变量
|
||||
ENV NODE_ENV=production
|
||||
# 创建非root用户
|
||||
|
|
@ -52,4 +52,4 @@ EXPOSE 3000
|
|||
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
||||
CMD curl -f http://localhost:3000/health || exit 1
|
||||
# 启动应用
|
||||
CMD ["node", "dist/main"]
|
||||
CMD ["node", "dist/src/main"]
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import {
|
|||
PlatformUserInfo,
|
||||
TokenRefreshResult,
|
||||
} from '../interfaces/platform.interface';
|
||||
import crypto from 'crypto';
|
||||
|
||||
interface WechatAuthResponse {
|
||||
openid: string;
|
||||
|
|
@ -227,7 +228,6 @@ export class WechatAdapter extends BaseAdapter {
|
|||
): WechatUserInfo {
|
||||
// 实现微信用户信息解密逻辑
|
||||
// 使用crypto模块进行AES解密
|
||||
const crypto = require('crypto');
|
||||
const decipher = crypto.createDecipheriv(
|
||||
'aes-128-cbc',
|
||||
Buffer.from(sessionKey, 'base64'),
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
"forceConsistentCasingInFileNames": true,
|
||||
"noImplicitAny": false,
|
||||
"strictBindCallApply": false,
|
||||
"noFallthroughCasesInSwitch": false
|
||||
"noFallthroughCasesInSwitch": false,
|
||||
"types": ["node"]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue