Repository navigation
fix: isolated vm for dev build - #4670
Conversation
Summary by CodeRabbit
WalkthroughDockerfile changes add a dedicated Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Builder as prodDepsBuilder
participant Dev as dev stage
rect rgb(220,235,255)
note right of Builder: Production dependency preparation flow
Builder->>Builder: npm ci --omit=dev (scripts disabled)
Builder->>Builder: npm run prepare
Builder->>Builder: npm run clean:node
end
rect rgb(235,255,220)
note right of Dev: Development flow (layering adjusted)
Dev->>Dev: RUN npm ci
Dev->>Dev: RUN npm run prepare -- separate layer
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Suggestion: Consider adding a short comment near the dev-stage change explaining why Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).Please share your feedback with us on this Discord post. 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
Dockerfile (2)
50-52: Clarify intent and harden the prod deps step; ensurepreparedoesn’t need dev/repo files.You disable install-time scripts (good), then explicitly run our
prepare. That’s fine ifprepare:
- doesn’t rely on devDependencies (they’re omitted), and
- doesn’t require repo files not present in this stage (only package*.json are copied here).
Consider making
prepareoptional and aligning the comment with the behavior.Proposed tweak:
-# Install production dependencies with scripts disabled for security -RUN npm ci --ignore-scripts --omit=dev --no-audit --cache .npm && \ -npm run prepare && npm run clean:node +# Install production dependencies with lifecycle scripts disabled; run only our trusted scripts explicitly +RUN npm ci --ignore-scripts --omit=dev --no-audit --cache .npm && \ +npm run --if-present prepare && npm run clean:nodePlease confirm:
npm run preparedoes not invoke any repo-local scripts/files beyond package.json (since the source isn’t copied in this stage).- It doesn’t require devDependencies.
- If the goal is to build native addons (e.g., isolated-vm) that normally rely on dependency postinstall scripts, confirm
preparehandles any required rebuilds; otherwise we may need an explicit, constrainednpm rebuild <module>step here.
55-61: Set NODE_ENV=production in the final image.Small hardening/perf win: ensures libraries respect production mode at runtime.
Suggested addition:
FROM base as production ENV HUSKY 0 +ENV NODE_ENV=production
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
Dockerfile(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
- GitHub Check: Build User Transformer Docker Image - PR / Build Transformer Docker Image AMD64
- GitHub Check: Build User Transformer Docker Image - PR / Build Transformer Docker Image ARM64
- GitHub Check: Build Transformer Docker Image - PR / Build Transformer Docker Image AMD64
- GitHub Check: Build Transformer Docker Image - PR / Build Transformer Docker Image ARM64
- GitHub Check: Code Coverage
- GitHub Check: UT Tests
- GitHub Check: test_and_publish
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: Analyze (go)
🔇 Additional comments (1)
Dockerfile (1)
28-28: No semantic change; OK to keep.This is only a formatting split of the existing command sequence.
|
Allure Test reports for this run are available at:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #4670 +/- ##
========================================
Coverage 91.78% 91.78%
========================================
Files 642 642
Lines 33974 33976 +2
Branches 8043 8043
========================================
+ Hits 31184 31186 +2
Misses 2538 2538
Partials 252 252 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Allure Test reports for this run are available at:
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
Dockerfile-ut-func (1)
54-55: Assert the native binary exists after prepare; consider explicit rebuild as fallback.To fail fast and prove the fix, assert the compiled addon is present. Optionally, explicitly rebuild isolated‑vm after
cito decouple fromprepare.Option A (add existence check; preferred):
-RUN npm ci --ignore-scripts --omit=dev --no-audit --cache .npm && \ -npm run prepare && npm run clean:node +RUN npm ci --ignore-scripts --omit=dev --no-audit --cache .npm && \ + npm run prepare && \ + test -e node_modules/isolated-vm/out/isolated_vm.node && \ + npm run clean:nodeOption B (explicit rebuild, then clean):
-RUN npm ci --ignore-scripts --omit=dev --no-audit --cache .npm && \ -npm run prepare && npm run clean:node +RUN npm ci --ignore-scripts --omit=dev --no-audit --cache .npm && \ + npm run prepare && npm rebuild isolated-vm && \ + npm run clean:nodeIf native builds intermittently fail due to missing Python for node-gyp, add python3 to the base image (optional):
- && apt-get install -y curl make g++ \ + && apt-get install -y curl make g++ python3 \
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
Dockerfile-ut-func(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
- GitHub Check: Code Coverage
- GitHub Check: Build User Transformer Docker Image - PR / Build Transformer Docker Image ARM64
- GitHub Check: Build User Transformer Docker Image - PR / Build Transformer Docker Image AMD64
- GitHub Check: Build Transformer Docker Image - PR / Build Transformer Docker Image ARM64
- GitHub Check: Build Transformer Docker Image - PR / Build Transformer Docker Image AMD64
- GitHub Check: UT Tests
- GitHub Check: test_and_publish
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (1)
Dockerfile-ut-func (1)
34-35: Confirmpreparedoesn’t depend on repo sources (it runs before COPY).Verification script failed to locate package.json (jq error), so I couldn't confirm whether scripts.prepare rebuilds isolated‑vm or references repo/.git. Paste the prepare script (scripts.prepare in package.json) or run: fd -HI -t f -a '^package.json$' | head -n1 && jq -r '.scripts.prepare // ""' and share the output. If prepare doesn't explicitly rebuild isolated‑vm, either make it run
npm rebuild isolated-vm(or equivalent) or movenpm run prepareto after COPY so repo files/.git are available.
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (3)
Dockerfile (3)
28-28: Splitting prepare into its own layer is fine; consider chaining to reduce layersNot blocking. If image layers matter, you can keep it in the same RUN chain as npm ci for a smaller image.
51-54: Keep build tools out of the final imageCurrently base installs make/g++/python3; since production is FROM base, these land in the final image. Consider installing toolchains only in builder stages (development/prodDepsBuilder) and using a slimmer base for production to reduce attack surface and size. If needed, I can propose a minimal rearrangement.
51-54: Add a lightweight sanity check to catch regressionsOptional: verify the native addon is loadable during prodDepsBuilder to fail fast.
RUN npm ci --ignore-scripts --omit=dev --no-audit --cache .npm && \ npm rebuild isolated-vm && \ npm run clean:node +RUN node -e 'require("isolated-vm")'
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
Dockerfile(3 hunks)Dockerfile-ut-func(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- Dockerfile-ut-func
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
- GitHub Check: Build Transformer Docker Image - PR / Build Transformer Docker Image AMD64
- GitHub Check: Build Transformer Docker Image - PR / Build Transformer Docker Image ARM64
- GitHub Check: Build User Transformer Docker Image - PR / Build Transformer Docker Image ARM64
- GitHub Check: Build User Transformer Docker Image - PR / Build Transformer Docker Image AMD64
- GitHub Check: Code Coverage
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: Analyze (go)
- GitHub Check: check-health
- GitHub Check: test_and_publish
- GitHub Check: UT Tests
🔇 Additional comments (4)
Dockerfile (4)
32-34: Build chain LGTMBuild, copy, and swagger setup sequence looks correct.
39-39: Healthcheck formatting change is fineNo behavior change; keeps the same semantics.
51-54: Key fix: prepare after ci to compile isolated-vm on AlpineThis should address the missing native binary in prod by rebuilding after scripts were ignored during ci.
- Please confirm that your package.json prepare script actually rebuilds isolated-vm (e.g., via npm rebuild isolated-vm) and that npm run clean:node does not remove the compiled addon.
- Also confirm you applied the same change in Dockerfile-ut-func as discussed.
Optionally, make the intent explicit and avoid side effects from a broader prepare by rebuilding just the module:
-RUN npm ci --ignore-scripts --omit=dev --no-audit --cache .npm && \ -npm run prepare && \ +RUN npm ci --ignore-scripts --omit=dev --no-audit --cache .npm && \ +npm rebuild isolated-vm && \ npm run clean:node
77-77: Healthcheck formatting change is fineNo behavior change; approved.
|
Allure Test reports for this run are available at:
|
|



What are the changes introduced in this PR?
Production Docker builds were failing with the error:
This occurred because the isolated-vm native module was not being properly compiled for the Alpine Linux environment in the production stage of the multi-stage Docker build.
Root Cause
The prodDepsBuilder stage was using npm ci --ignore-scripts which prevented the necessary native module compilation, while the production stage copied node_modules without the properly compiled binaries for isolated-vm.
Solution
Modified the prodDepsBuilder stage to explicitly rebuild the isolated-vm module after installing production dependencies:
What is the related Linear task?
Resolves INT-XXX
Please explain the objectives of your changes below
Put down any required details on the broader aspect of your changes. If there are any dependent changes, mandatorily mention them here
Any changes to existing capabilities/behaviour, mention the reason & what are the changes ?
N/A
Any new dependencies introduced with this change?
N/A
Any new generic utility introduced or modified. Please explain the changes.
N/A
Any technical or performance related pointers to consider with the change?
N/A
@coderabbitai review
Developer checklist
My code follows the style guidelines of this project
No breaking changes are being introduced.
All related docs linked with the PR?
All changes manually tested?
Any documentation changes needed with this change?
Is the PR limited to 10 file changes?
Is the PR limited to one linear task?
Are relevant unit and component test-cases added in new readability format?
Reviewer checklist
Is the type of change in the PR title appropriate as per the changes?
Verified that there are no credentials or confidential data exposed with the changes.