Skip to content

Commit ffb04bd

Browse files
ZRTMRHclaude
andcommitted
Move client build to Docker build phase to avoid runtime memory limits
- Pre-build both server and client during Docker build (more memory available) - Remove runtime client build that was causing JavaScript heap out of memory - Server runs immediately with pre-built assets - Should resolve 404 errors from missing client/dist/ directory 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent de3e78b commit ffb04bd

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,11 @@ COPY --chown=node:node . .
5252
# Build the project (only this step runs if game files change)
5353
RUN echo "Building Lean project..." && lake build
5454

55-
# Pre-build lean4game server to avoid runtime delays (client builds at runtime)
56-
RUN echo "Pre-building lean4game server..." && \
57-
cd /home/node/lean4game && npm run build_server
55+
# Pre-build lean4game server and client to avoid runtime memory issues
56+
RUN echo "Pre-building lean4game server and client..." && \
57+
cd /home/node/lean4game && \
58+
npm run build_server && \
59+
npm run build_client
5860

5961
# Apply port binding fix to relay server
6062
COPY relay-patch.mjs /home/node/lean4game/relay/index.mjs

start-server.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ echo "ASSIGNED_PORT=$ASSIGNED_PORT"
5959
echo "PORT (from Render)=${PORT:-'not set'}"
6060

6161
echo "Starting server in production mode for memory efficiency..."
62-
echo "Building client for production..."
63-
cd /home/node/lean4game && npm run build_client
62+
echo "Client should be pre-built during Docker build phase..."
6463
echo "Verifying lean4game relay server exists..."
6564
if [ -f "/home/node/lean4game/relay/index.mjs" ]; then
6665
echo "✅ Relay server found!"

0 commit comments

Comments
 (0)