- #2 JWT HttpOnly Cookie: authSlice/LoginModalContext 不再向 localStorage 写入 access/refresh/token_type (仅存非敏感 user), 登出/401 时调用 POST /user/logout/ 清服务端 Cookie; axios withCredentials=true, 401 无 token 也走 /user/token/refresh/ 空载荷刷新(单飞); WS createWebSocket token 参数可省略由 Cookie 鉴权; Navbar/MobileTopNav/Chat/ChatMobile/Bug/ useRecordHistory 的 localStorage access_token 判断改走登录态 - P2 #10 死依赖清理: 移除 @chakra-ui/react @emotion/react next-themes zustand react-lorem-ipsum react-syntax-highlighter qrcode.react @types/qrcode; 删 components/ui 整目录与 Markdown/Markdown.tsx; 删 package-lock.json yarn.lock 仅留 pnpm-lock; untrack tsconfig.tsbuildinfo - Dockerfile: 弃用 npm install, 改 corepack pnpm@9 --frozen-lockfile - nginx.conf: API 白名单补 air-quality/weather/currency/shorturl, 补 /swagger.json 反代
32 lines
612 B
Docker
32 lines
612 B
Docker
FROM node:20-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# 安装并启用 pnpm
|
|
RUN corepack enable && corepack prepare pnpm@9.15.9 --activate
|
|
|
|
# 复制依赖定义与锁文件
|
|
COPY package.json pnpm-lock.yaml ./
|
|
|
|
# 冻结安装依赖
|
|
RUN pnpm install --frozen-lockfile --registry=https://registry.npmmirror.com
|
|
|
|
# 复制项目代码
|
|
COPY . .
|
|
|
|
# 构建项目
|
|
RUN pnpm run build
|
|
|
|
FROM nginx:alpine AS production
|
|
|
|
# 复制构建文件到Nginx
|
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
|
|
|
# 复制Nginx配置
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
# 暴露端口
|
|
EXPOSE 80
|
|
|
|
CMD ["nginx", "-g", "daemon off;"]
|