From d316c24ceac805870b9b22b5aae51d98c586b25e Mon Sep 17 00:00:00 2001 From: luojiyin Date: Fri, 2 Aug 2024 23:13:37 +0800 Subject: [PATCH] use standalone --- Dockerfile | 11 ++++------- next.config.mjs | 1 + 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4ec04a2..b5ab0a9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,16 +12,13 @@ RUN corepack enable COPY . /app WORKDIR /app -FROM base AS prod-deps -RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm i -P --frozen-lockfile --ignore-scripts - FROM base AS build RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm i --frozen-lockfile RUN pnpm build FROM gcr.io/distroless/nodejs18-debian12 -COPY --from=prod-deps /app/node_modules ./node_modules -COPY --from=build /app/public ./public -COPY --from=build /app/.next ./.next + +COPY --from=build /app/.next/standalone ./ +COPY --from=build /app/.next/static ./.next/static EXPOSE 3000 -CMD ["./node_modules/next/dist/bin/next", "start"] \ No newline at end of file +CMD ["server.js"] \ No newline at end of file diff --git a/next.config.mjs b/next.config.mjs index 3f4269d..78d3e36 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -30,6 +30,7 @@ const withPWA = setPWA({ const nextConfig = withPWA( withLess( withMDX({ + output: 'standalone' , pageExtensions: ['ts', 'tsx', 'js', 'jsx', 'md', 'mdx'], webpack: config => {