Repository navigation
fix(create-voltagent-app): generate Dockerfile dependency layers for the selected package manager - #1441
fix(create-voltagent-app): generate Dockerfile dependency layers for the selected package manager#1441Winoren wants to merge 2 commits into
Conversation
…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
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
There was a problem hiding this comment.
All reported issues were addressed across 3 files
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
|
Describe the changes
create-voltagent-appgenerated one Dockerfile for every project, with unconditionalCOPY yarn.lock* ./andCOPY pnpm-lock.yaml* ./instructions in both stages. Docker validates eachCOPYsource against the build context before anyRUNfallback executes, so an npm project (onlypackage.json+package-lock.json) failed its firstdocker buildat theyarn.lockcopy and thenpm cipath was never reached. Bun projects produce neither file and failed the same way.The Dockerfile is now rendered from
ProjectOptions.packageManager:package*.json(which matchespackage-lock.jsontoo) and runsnpm ci/npm ci --omit=dev.yarn.lock*and runsyarn install --frozen-lockfile/--production.pnpm-lock.yaml*and runspnpm install --frozen-lockfile/--prod(afternpm install -g pnpm).bun.lock*and runsbun install --frozen-lockfile/--production(afternpm 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
COPYfailure. The install commands are the same ones the previous runtime fallback dispatched — they just become reachable now.Validation
packages/create-voltagent-app/src/__tests__/templates.test.ts(all failed before the change, pass after):RUN npm ci/RUN npm ci --omit=dev, contains noyarn.lock/pnpm-lock.yamlyarn.lock*/pnpm-lock.yaml*/bun.lock*), and no other manager's lockfile leaks inCOPY package*.json ./kept in both stagesnpx vitest run src/__tests__/templates.test.ts→ 4 passednpx biome check src/utils/templates.ts src/__tests__/templates.test.ts→ cleannpm: dependency layer readsCOPY 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.lockandpnpm-lock.yaml, which Docker validates before any fallback logic runs. npm projects (which only havepackage-lock.json) and bun projects (which have neither file) failed at the firstCOPY. 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.package*.jsonand runnpm ci/npm ci --omit=dev.Written for commit 301d7df. Summary will update on new commits.
Summary by CodeRabbit
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.