Skip to content

Commit f10dfb8

Browse files
committed
feat: 仅对NEXT_BUILD_STANDALONE=true生效
1 parent 2e18ed2 commit f10dfb8

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

.env.example

+1
Original file line numberDiff line numberDiff line change
@@ -173,3 +173,4 @@
173173
# ENABLE_CACHE=
174174
# VERCEL_ENV=
175175
# NEXT_PUBLIC_VERSION=
176+
# NEXT_BUILD_STANDALONE=

Dockerfile

+5-1
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,20 @@ RUN yarn install --frozen-lockfile
1414
# 2. Rebuild the source code only when needed
1515
FROM base AS builder
1616
ARG NOTION_PAGE_ID
17+
ENV NEXT_BUILD_STANDALONE=true
18+
1719
WORKDIR /app
20+
1821
COPY --from=deps /app/node_modules ./node_modules
1922
COPY . .
2023
RUN yarn build
2124

2225
# 3. Production image, copy all the files and run next
2326
FROM base AS runner
27+
ENV NODE_ENV=production
28+
2429
WORKDIR /app
2530

26-
ENV NODE_ENV=production
2731

2832
COPY --from=builder /app/public ./public
2933

next.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ const nextConfig = {
8484
eslint: {
8585
ignoreDuringBuilds: true
8686
},
87-
output: process.env.EXPORT ? 'export' : 'standalone',
87+
output: process.env.EXPORT ? 'export' : process.env.NEXT_BUILD_STANDALONE === 'true' ? 'standalone' : undefined,
8888
staticPageGenerationTimeout: 120,
8989
// 多语言, 在export时禁用
9090
i18n: process.env.EXPORT

0 commit comments

Comments
 (0)