techprotrade commited on
Commit
29682c8
·
verified ·
1 Parent(s): 52239b4

Fix hung Next build: SSG timeout + fast-fail backend URL

Browse files
Files changed (2) hide show
  1. Dockerfile +6 -2
  2. next.config.js +6 -3
Dockerfile CHANGED
@@ -20,8 +20,12 @@ COPY --from=deps /app/node_modules ./node_modules
20
  COPY . .
21
  # Optional reactflow repair after full tree is present
22
  RUN node scripts/verify-reactflow.js || true
23
- ARG NEXT_PUBLIC_API_URL=
24
- ENV NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL}
 
 
 
 
25
  RUN npm run build
26
 
27
  FROM node:20-bookworm-slim AS runner
 
20
  COPY . .
21
  # Optional reactflow repair after full tree is present
22
  RUN node scripts/verify-reactflow.js || true
23
+ # During image build there is no backend — use a fast-fail URL so SSG cannot hang
24
+ ARG NEXT_PUBLIC_API_URL=http://127.0.0.1:9
25
+ ENV NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL} \
26
+ API_BASE_URL=${NEXT_PUBLIC_API_URL} \
27
+ BACKEND_URL=${NEXT_PUBLIC_API_URL} \
28
+ PYTHON_BACKEND_URL=${NEXT_PUBLIC_API_URL}
29
  RUN npm run build
30
 
31
  FROM node:20-bookworm-slim AS runner
next.config.js CHANGED
@@ -14,6 +14,8 @@ const nextConfig = {
14
  typescript: {
15
  ignoreBuildErrors: true,
16
  },
 
 
17
  output: 'standalone',
18
  images: {
19
  unoptimized: true,
@@ -21,12 +23,13 @@ const nextConfig = {
21
  transpilePackages: ["@chakra-ui/react", "@chakra-ui/icons", "@ark-ui/react"],
22
  outputFileTracingRoot: process.cwd(),
23
 
24
- // Disable SWC minification to work around "erator is not defined" bug
25
- // See: Phase 247-02 SUMMARY.md for details
26
- productionBrowserSourceMaps: true,
27
 
28
  experimental: {
29
  externalDir: true,
 
 
30
  },
31
 
32
  // Disable minification via webpack configuration
 
14
  typescript: {
15
  ignoreBuildErrors: true,
16
  },
17
+ // Fail hung getStaticProps/API calls during build instead of waiting forever
18
+ staticPageGenerationTimeout: 45,
19
  output: 'standalone',
20
  images: {
21
  unoptimized: true,
 
23
  transpilePackages: ["@chakra-ui/react", "@chakra-ui/icons", "@ark-ui/react"],
24
  outputFileTracingRoot: process.cwd(),
25
 
26
+ // Source maps bloat HF image build; disable in Space package
27
+ productionBrowserSourceMaps: false,
 
28
 
29
  experimental: {
30
  externalDir: true,
31
+ // Fewer page-data workers on small HF builders (avoids thrash/hangs)
32
+ cpus: 2,
33
  },
34
 
35
  // Disable minification via webpack configuration