From 9a1148e1bc5a6cd9902ad8a22344738f061a10e4 Mon Sep 17 00:00:00 2001 From: zch1234qq Date: Sat, 18 Oct 2025 01:45:48 +0000 Subject: [PATCH] 123 --- Dockerfile | 30 +- app/components/Message.tsx | 3 +- nginx.conf | 23 +- yarn.lock | 3715 ++++++++++++++++++++++++++++++++++++ 4 files changed, 3752 insertions(+), 19 deletions(-) create mode 100644 yarn.lock diff --git a/Dockerfile b/Dockerfile index 9124672..b3c59d3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,11 +6,6 @@ WORKDIR /app # 配置npm使用淘宝镜像源(解决国内网络问题) RUN npm config set registry https://registry.npmmirror.com -RUN npm config set disturl https://npm.taobao.org/dist -RUN npm config set electron_mirror https://npm.taobao.org/mirrors/electron/ -RUN npm config set puppeteer_download_host https://npm.taobao.org/mirrors -RUN npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/ -RUN npm config set phantomjs_cdnurl https://npm.taobao.org/mirrors/phantomjs/ # 复制package.json和package-lock.json COPY package*.json ./ @@ -24,20 +19,25 @@ COPY . . # 构建应用 RUN npm run build -# 生产阶段 - 使用阿里云Nginx镜像 -FROM nginx:alpine +# 生产阶段 - 使用Node镜像运行Next.js应用 +FROM node:20-alpine + +# 设置工作目录 +WORKDIR /app # 配置Alpine使用国内镜像源 RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories -# 复制构建产物到nginx的html目录 -COPY --from=builder /app/out /usr/share/nginx/html +# 复制构建产物 +COPY --from=builder /app/.next ./.next +COPY --from=builder /app/public ./public +COPY --from=builder /app/package*.json ./ -# 复制自定义nginx配置(如果需要) -COPY nginx.conf /etc/nginx/conf.d/default.conf +# 安装生产依赖 +RUN npm install --production -# 暴露80端口 -EXPOSE 80 +# 暴露Next.js默认端口 +EXPOSE 3000 -# 启动nginx -CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file +# 启动Next.js生产服务器 +CMD ["npm", "start"] \ No newline at end of file diff --git a/app/components/Message.tsx b/app/components/Message.tsx index 98f1116..8383a17 100644 --- a/app/components/Message.tsx +++ b/app/components/Message.tsx @@ -11,7 +11,7 @@ const Message: React.FC = ({ message, isLast = false }) => { const isUser = message.sender === 'user'; const theme = useTheme(); const isMobile = useMediaQuery(theme.breakpoints.down('sm')); - const paperRef = useRef(null); + const paperRef = useRef(null); // 计算气泡的borderRadius const borderRadius = isUser @@ -20,7 +20,6 @@ const Message: React.FC = ({ message, isLast = false }) => { return (