fix: docker node_modeles symlink path matching with pnpm path in live server#7605
Conversation
WalkthroughDockerfile for apps/live adjusts runner-stage copy destinations to apps/live paths, adds copying apps/live/node_modules, and updates the startup command to run node ./apps/live/dist/server.js. No other steps changed. No exported/public declarations affected. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Dev as Docker Build
participant Img as Image (Runner Stage)
participant Node as Node.js Runtime
participant App as apps/live App
Dev->>Img: Copy built dist -> ./apps/live/dist
Dev->>Img: Copy node_modules -> ./apps/live/node_modules
Note over Img: Image assembled with new paths
Img->>Node: Start with CMD node ./apps/live/dist/server.js
Node->>App: Load server.js from apps/live/dist
App-->>Node: Initialize server
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
apps/live/Dockerfile.live (2)
56-57: Aligns paths with pnpm workspace; consider symlink instead of copying app-level node_modules to cut image sizeCopying both root-level and app-level node_modules duplicates the dependency tree. A lightweight alternative is to symlink apps/live/node_modules to /app/node_modules in the runner stage, which still satisfies Node resolution and typical pnpm symlink expectations while avoiding duplication.
Apply this diff to replace the copy with a symlink:
COPY --from=installer /app/apps/live/dist ./apps/live/dist -COPY --from=installer /app/apps/live/node_modules ./apps/live/node_modules COPY --from=installer /app/node_modules ./node_modules +RUN ln -s /app/node_modules /app/apps/live/node_modulesNote: If you choose to keep copying apps/live/node_modules, double-check that symlinks are preserved as intended in the final layer (and not dereferenced), otherwise you may lose the pnpm layout benefits. Also, if the live app relies on ESM via "type": "module", consider copying apps/live/package.json as well to ensure correct module type resolution at runtime.
64-64: Entry point path update looks correct; optionally enable source maps for better runtime diagnosticsThe switch to apps/live/dist/server.js matches the new copy destination. For improved error stacks in production, you can enable source maps if your build emits them.
Apply this small tweak:
-CMD ["node", "apps/live/dist/server.js"] +CMD ["node", "--enable-source-maps", "apps/live/dist/server.js"]Optional: If the app expects process.cwd() to be apps/live, consider setting WORKDIR to /app/apps/live and running node dist/server.js instead, but that’s not required for correctness here.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
apps/live/Dockerfile.live(1 hunks)
Description
Type of Change
Summary by CodeRabbit