chore(docker): add frontend docker configuration files
Change-Id: Ic6e0a66f1a06a5a232b000bdf4d1fa43f7318536
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..af2bef1
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,39 @@
+# 阶段 1: 构建应用
+FROM node:bullseye AS builder
+
+# 设置工作目录
+WORKDIR /app
+
+# 安装依赖 (利用 Docker 层缓存)
+COPY package.json yarn.lock* package-lock.json* ./
+RUN npm ci --omit=dev
+
+# 复制源代码
+COPY . .
+
+# 构建应用 (standalone 模式)
+RUN npm run build
+
+# 阶段 2: 创建轻量级运行环境
+FROM node:bullseye AS runner
+WORKDIR /app
+
+# 不要以 root 用户运行
+RUN addgroup --system --gid 1001 nodejs
+RUN adduser --system --uid 1001 nextjs
+USER nextjs
+
+# 从构建阶段复制必要文件
+COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
+COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
+COPY --from=builder --chown=nextjs:nodejs /app/public ./public
+
+# 设置环境变量
+ENV NODE_ENV=production
+ENV PORT=3000
+
+# 暴露端口
+EXPOSE 3000
+
+# 启动命令
+CMD ["node", "server.js"]
\ No newline at end of file
diff --git a/next.config.ts b/next.config.ts
index 1e61e5f..4737600 100644
--- a/next.config.ts
+++ b/next.config.ts
@@ -2,9 +2,10 @@
const nextConfig: NextConfig = {
/* config options here */
+ output: 'standalone',
env: {
- NEXT_PUBLIC_NGINX_URL: "http://localhost:65/",
- PUBLIC_URL:"http://127.0.0.1:4523/m1/6387307-6083949-default",
+ NEXT_PUBLIC_NGINX_URL: process.env.NEXT_PUBLIC_NGINX_URL || "http://localhost:65/",
+ PUBLIC_URL: process.env.NEXT_PUBLIC_API_URL || "http://127.0.0.1:4523/m1/6387307-6083949-default",
},
};
diff --git "a/src/app/user/\133tab\135/page.tsx" "b/src/app/user/\133tab\135/page.tsx"
deleted file mode 100644
index c48b626..0000000
--- "a/src/app/user/\133tab\135/page.tsx"
+++ /dev/null
@@ -1,12 +0,0 @@
-'use client';
-import React from 'react';
-
-const EmptyPage: React.FC = () => {
- return (
- <div className="p-d-flex p-jc-center p-ai-center" style={{ height: '100vh' }}>
- {"一个空页面"}
- </div>
- );
-};
-
-export default EmptyPage;