From 965270b6e36251c05c0bf0284909cc63b5a5ec35 Mon Sep 17 00:00:00 2001 From: HouYunFei <1844025705@qq.com> Date: Tue, 2 Jun 2026 14:37:13 +0800 Subject: [PATCH] feat(docker): update Dockerfile for standalone Next.js app and adjust build paths --- Dockerfile | 9 +++++++-- web/next-env.d.ts | 2 +- web/next.config.ts | 1 + 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9e89b32..854d1d5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -31,11 +31,16 @@ WORKDIR /app COPY VERSION /app/VERSION COPY CHANGELOG.md /app/CHANGELOG.md COPY --from=api-build /server /app/server -COPY --from=web-build /app/web /app/web +COPY --from=web-build /app/web/public /app/web/public +COPY --from=web-build /app/web/.next/standalone /app/web +COPY --from=web-build /app/web/.next/static /app/web/.next/static +ENV NODE_ENV=production +ENV HOSTNAME=0.0.0.0 +ENV PORT=3000 ENV PROMPT_DATA_DIR=/app/data/prompts RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates && rm -rf /var/lib/apt/lists/* RUN mkdir -p /app/data/prompts EXPOSE 3000 # 先启动内部 Go API,再由 Next.js 提供页面并代理 /api/*。 -CMD ["sh", "-c", "PORT=8080 /app/server & cd /app/web && HOSTNAME=0.0.0.0 PORT=3000 npm run start"] +CMD ["sh", "-c", "PORT=8080 /app/server & cd /app/web && node server.js"] diff --git a/web/next-env.d.ts b/web/next-env.d.ts index c4b7818..9edff1c 100644 --- a/web/next-env.d.ts +++ b/web/next-env.d.ts @@ -1,6 +1,6 @@ /// /// -import "./.next/dev/types/routes.d.ts"; +import "./.next/types/routes.d.ts"; // NOTE: This file should not be edited // see https://nextjs.org/docs/app/api-reference/config/typescript for more information. diff --git a/web/next.config.ts b/web/next.config.ts index 708701f..3af60aa 100644 --- a/web/next.config.ts +++ b/web/next.config.ts @@ -14,6 +14,7 @@ export default function nextConfig(phase: string): NextConfig { const releases = parseChangelog(localChangelog); return { + output: "standalone", allowedDevOrigins: isDev ? ["*.*.*.*"] : [], typescript: { ignoreBuildErrors: true,