feat: 仅对NEXT_BUILD_STANDALONE=true生效

This commit is contained in:
yangsong13
2024-11-21 20:06:58 +08:00
parent 2e18ed2e0e
commit f10dfb8172
3 changed files with 7 additions and 2 deletions

View File

@@ -173,3 +173,4 @@
# ENABLE_CACHE= # ENABLE_CACHE=
# VERCEL_ENV= # VERCEL_ENV=
# NEXT_PUBLIC_VERSION= # NEXT_PUBLIC_VERSION=
# NEXT_BUILD_STANDALONE=

View File

@@ -14,16 +14,20 @@ RUN yarn install --frozen-lockfile
# 2. Rebuild the source code only when needed # 2. Rebuild the source code only when needed
FROM base AS builder FROM base AS builder
ARG NOTION_PAGE_ID ARG NOTION_PAGE_ID
ENV NEXT_BUILD_STANDALONE=true
WORKDIR /app WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules COPY --from=deps /app/node_modules ./node_modules
COPY . . COPY . .
RUN yarn build RUN yarn build
# 3. Production image, copy all the files and run next # 3. Production image, copy all the files and run next
FROM base AS runner FROM base AS runner
ENV NODE_ENV=production
WORKDIR /app WORKDIR /app
ENV NODE_ENV=production
COPY --from=builder /app/public ./public COPY --from=builder /app/public ./public

View File

@@ -84,7 +84,7 @@ const nextConfig = {
eslint: { eslint: {
ignoreDuringBuilds: true ignoreDuringBuilds: true
}, },
output: process.env.EXPORT ? 'export' : 'standalone', output: process.env.EXPORT ? 'export' : process.env.NEXT_BUILD_STANDALONE === 'true' ? 'standalone' : undefined,
staticPageGenerationTimeout: 120, staticPageGenerationTimeout: 120,
// 多语言, 在export时禁用 // 多语言, 在export时禁用
i18n: process.env.EXPORT i18n: process.env.EXPORT