fraudTech commited on
Commit
44c9c99
·
1 Parent(s): 01c7609

fix exit 137 (OOM-kill during pod build)

Browse files
Files changed (3) hide show
  1. Dockerfile +3 -0
  2. web/src/App.tsx +5 -1
  3. web/vite.config.ts +20 -0
Dockerfile CHANGED
@@ -14,6 +14,9 @@ COPY web/ ./
14
  ARG VITE_GATEWAY_URL=https://deepthoughtai-evo-gateway.hf.space
15
  ENV VITE_GATEWAY_URL=$VITE_GATEWAY_URL
16
 
 
 
 
17
  # Build the app (Vite will use VITE_GATEWAY_URL)
18
  RUN npm run build
19
 
 
14
  ARG VITE_GATEWAY_URL=https://deepthoughtai-evo-gateway.hf.space
15
  ENV VITE_GATEWAY_URL=$VITE_GATEWAY_URL
16
 
17
+ # Increase Node.js heap to prevent OOM-kill (exit 137) during Vite/tsc build
18
+ ENV NODE_OPTIONS=--max-old-space-size=2048
19
+
20
  # Build the app (Vite will use VITE_GATEWAY_URL)
21
  RUN npm run build
22
 
web/src/App.tsx CHANGED
@@ -587,7 +587,11 @@ function App() {
587
  }, [theme]);
588
 
589
  const toggleTheme = () => setTheme(t => t === 'dark' ? 'light' : 'dark');
590
- const codeTheme = theme === 'dark' ? terminalTheme : lightCodeTheme;
 
 
 
 
591
 
592
  const chatPlaceholder = useMemo(
593
  () => LOGIC_SAYINGS[Math.floor(Math.random() * LOGIC_SAYINGS.length)],
 
587
  }, [theme]);
588
 
589
  const toggleTheme = () => setTheme(t => t === 'dark' ? 'light' : 'dark');
590
+ // Memoize so CodeThemeContext.Provider doesn't re-render all consumers on every render
591
+ const codeTheme = useMemo(
592
+ () => (theme === 'dark' ? terminalTheme : lightCodeTheme),
593
+ [theme]
594
+ );
595
 
596
  const chatPlaceholder = useMemo(
597
  () => LOGIC_SAYINGS[Math.floor(Math.random() * LOGIC_SAYINGS.length)],
web/vite.config.ts CHANGED
@@ -12,4 +12,24 @@ export default defineConfig({
12
  },
13
  },
14
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  });
 
12
  },
13
  },
14
  },
15
+ build: {
16
+ // Split vendor chunks to reduce peak memory during bundling
17
+ rollupOptions: {
18
+ output: {
19
+ manualChunks: {
20
+ 'react-vendor': ['react', 'react-dom'],
21
+ 'markdown-vendor': [
22
+ 'react-markdown',
23
+ 'remark-math',
24
+ 'remark-gfm',
25
+ 'rehype-katex',
26
+ ],
27
+ 'syntax-vendor': ['react-syntax-highlighter'],
28
+ 'katex-vendor': ['katex'],
29
+ },
30
+ },
31
+ },
32
+ // Raise warning limit (katex + prism are legitimately large)
33
+ chunkSizeWarningLimit: 1000,
34
+ },
35
  });