fix(create-voltagent-app): generate Dockerfile dependency layers for the selected package manager
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 matchespackage-lock.jsontoo) and runsnpm ci/npm ci --omit=dev. - yarn: copies
yarn.lock*and runsyarn install --frozen-lockfile/--production. - pnpm: copies
pnpm-lock.yaml*and runspnpm install --frozen-lockfile/--prod(afternpm install -g pnpm). - bun: copies
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 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 noyarn.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
- npm render: contains
npx vitest run src/__tests__/templates.test.ts→ 4 passednpx biome check src/utils/templates.ts src/__tests__/templates.test.ts→ clean- Manually rendered the template for
npm: 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.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*.jsonand runnpm 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.
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.