Skip to content

fix(create-voltagent-app): generate Dockerfile dependency layers for the selected package manager - #1441

Open
Winoren wants to merge 2 commits into
VoltAgent:mainfrom
Winoren:fix/dockerfile-package-manager-layers
Open

Winoren wants to merge 2 commits into
VoltAgent:mainfrom
Winoren:fix/dockerfile-package-manager-layers

Conversation

@Winoren

@Winoren Winoren commented Oct 7, 2026 •

Copy link
Copy Markdown

Describe the changes

create-voltagent-app generated one Dockerfile for every project, with unconditional COPY yarn.lock* ./ and COPY pnpm-lock.yaml* ./ instructions in both stages. Docker validates each COPY source against the build context before any RUN fallback executes, so an npm project (only package.json + package-lock.json) failed its first docker build at the yarn.lock copy and the npm ci path was never reached. Bun projects produce neither file and failed the same way.

The Dockerfile is now rendered from ProjectOptions.packageManager:

  • npm: copies package*.json (which matches package-lock.json too) and runs npm ci / npm ci --omit=dev.
  • yarn: copies yarn.lock* and runs yarn install --frozen-lockfile / --production.
  • pnpm: copies pnpm-lock.yaml* and runs pnpm install --frozen-lockfile / --prod (after npm install -g pnpm).
  • bun: copies bun.lock* and runs bun install --frozen-lockfile / --production (after npm install -g bun).

The lockfile copy line is emitted only when the selected package manager has one, so npm projects no longer get an empty COPY failure. The install commands are the same ones the previous runtime fallback dispatched — they just become reachable now.

Validation

  • New tests in packages/create-voltagent-app/src/__tests__/templates.test.ts (all failed before the change, pass after):
    • npm render: contains RUN npm ci / RUN npm ci --omit=dev, contains no yarn.lock / pnpm-lock.yaml
    • lockfile copy matches the selection (yarn.lock* / pnpm-lock.yaml* / bun.lock*), and no other manager's lockfile leaks in
    • install commands match the selection per stage
    • COPY package*.json ./ kept in both stages
  • npx vitest run src/__tests__/templates.test.ts → 4 passed
  • npx biome check src/utils/templates.ts src/__tests__/templates.test.ts → clean
  • Manually rendered the template for npm: dependency layer reads COPY package*.json ./ → RUN npm ci, no stray lockfile copies.

Fixes #1427


Summary by cubic

Fixes Docker builds failing for npm and bun projects generated by create-voltagent-app.

The Dockerfile template unconditionally copied yarn.lock and pnpm-lock.yaml, which Docker validates before any fallback logic runs. npm projects (which only have package-lock.json) and bun projects (which have neither file) failed at the first COPY. The Dockerfile now renders its lockfile copy and install commands from the package manager selected in the wizard, so each project only references its own files.

  • npm projects copy package*.json and run npm ci / npm ci --omit=dev.
  • Yarn, pnpm, and bun projects copy their own lockfile and use their native install commands.
  • Adds tests covering the rendered Dockerfile per package manager.

Written for commit 301d7df. Summary will update on new commits.

View guided diff

Summary by CodeRabbit

  • New Features
    • Dockerfiles generated by the app scaffolder now use install commands and lockfiles that match the selected package manager, including Bun.
    • Generated Dockerfiles copy package manifests in both build stages.

Current revision validation

All 6 Dockerfile template tests pass. Each package manager is checked against exact builder and production commands and excludes foreign lockfiles. Biome passes. Docker image builds were not run.

…the selected package manager

The Dockerfile template shipped unconditional COPY yarn.lock* and COPY
pnpm-lock.yaml* instructions in both stages. Docker validates each COPY
source against the build context before any RUN fallback executes, so an
npm project (package.json + package-lock.json only) failed its first docker
build at the yarn.lock copy, and the npm ci path was never reached. Bun
projects produce neither file and failed the same way, regardless of the
package manager chosen in the wizard.

Render the lockfile COPY and the install commands from
ProjectOptions.packageManager instead: npm projects copy package*.json and
run npm ci / npm ci --omit=dev, while yarn, pnpm and bun projects copy only
their own lockfile and run their own install commands (the same commands the
previous runtime fallback dispatched).

Fixes VoltAgent#1427
@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 57360a47-ae9b-4394-b880-04a61ff71319
📥 Commits

Reviewing files that changed from the base of the PR and between 301d7df and ee0c1fa.

📒 Files selected for processing: 1
  • packages/create-voltagent-app/src/__tests__/templates.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

📝 Walkthrough

The Dockerfile template now renders lockfile copies and dependency-install commands for npm, Yarn, pnpm, and Bun. Tests check the rendered commands, lockfiles, and package manifest copies.

Changes: Dockerfile rendering

Layer / File(s) Summary
Render and verify package-manager commands
packages/create-voltagent-app/src/utils/templates.ts, packages/create-voltagent-app/templates/base/Dockerfile.template, packages/create-voltagent-app/src/__tests__/templates.test.ts
The transform selects lockfile-copy and install-command strings for the configured package manager. Both Dockerfile stages use generated placeholders. Tests check package-manager-specific commands and lockfiles, and check that the npm Dockerfile copies package.json in both stages.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to ee0c1

The change makes generated Dockerfiles use the selected package manager's lockfiles and install commands, and tests cover the rendered output. No merge-blocking risk was identified.

Pre-merge checks: Passed 5
Passed Passed checks: 5 passed
Check name Status Explanation
Linked Issues check Passed Issue #1427 requires package-manager-specific dependency layers in both Dockerfile stages. packages/create-voltagent-app/src/utils/templates.ts selects the lockfile copy and install commands from `P…
Out of Scope Changes check Passed The changes are limited to the Dockerfile template, its package-manager renderer, and focused rendering tests. These changes directly support issue #1427. No unrelated product or repository changes ar…
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
Title check Passed The title clearly and concisely describes the main change: generating Dockerfile dependency layers for the selected package manager.
Description check Passed The description explains the current failure, the new package-manager-specific behavior, validation results, linked issue, and reviewer context. It does not reproduce every template heading or explici…
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 3 files

Reply with feedback, questions, or to request a fix.

View guided diff | Re-trigger cubic

Comment thread packages/create-voltagent-app/src/__tests__/templates.test.ts Outdated
Comment thread packages/create-voltagent-app/src/__tests__/templates.test.ts Outdated
@changeset-bot

changeset-bot Bot commented Oct 14, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: ee0c1fa

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Generated Dockerfile fails on npm projects because it requires Yarn and pnpm lockfiles

1 participant