steep-balloon-41261
02/17/2026, 1:16 PMtall-airline-16756
02/17/2026, 1:16 PMtall-airline-16756
02/17/2026, 1:16 PMlk agent create from inside packages/agent/ of a pnpm workspace, and the Dockerfile’s COPY pnpm-lock.yaml ./ fails because the lockfile lives at the monorepo root. I can help — below are safe, practical options and a recommended workflow to make the agent build self-contained.
Quick recommendation (simplest, least risky)
• Before running lk agent create, copy the root lockfile into the agent folder:
a. From the monorepo root:
• cp pnpm-lock.yaml packages/agent/pnpm-lock.yaml
a. Change into the agent package and create the agent:
• cd packages/agent && lk agent create
• This ensures pnpm install --frozen-lockfile inside the Docker build can resolve workspace deps.
Why this works
• The lockfile contains the resolved versions for your workspace packages. Having it next to the package makes the default Dockerfile’s COPY pnpm-lock.yaml ./ and pnpm install --frozen-lockfile succeed without copying the whole repo.
Other approaches (when you need more control)
Option A — Custom Dockerfile (flexible, but be careful)
• Create a Dockerfile that sets the build context or copies from parent folders and then sets WORKDIR to packages/agent.
• Example changes:
◦ COPY a parent path, then WORKDIR into packages/agent.
• Important: copying the entire repo into the container increases context size and risk. Use a .dockerignore to exclude unnecessary files if you go this route.
Option B — Build-time packaging (clean, reproducible)
• Create a short script to assemble a minimal deployment folder for the agent:
a. From repo root, create a temp dir (e.g., dist/agent-build).
b. Copy packages/agent/ files needed for build.
c. Copy pnpm-lock.yaml into that folder.
d. Run lk agent create against that minimal directory.
• This avoids leaking the whole monorepo into the build context and gives you precise control over what’s deployed.
Make sure workspace deps will resolve
• Your agent uses workspace:* protocol for internal packages. As long as the pnpm-lock.yaml used in the build matches the monorepo root lockfile, pnpm install --frozen-lockfile will provide the correct resolutions for the workspace packages.
Use .dockerignore to keep context small
• Put a .dockerignore in packages/agent/ (or in your build folder) to exclude node_modules, tests, large assets, or other sibling packages you don’t want shipped. Example entries:
◦ node_modules
◦ .env
◦ **/tests
◦ ../* (or otherwise exclude sibling directories), and allow only the pnpm-lock.yaml if needed.
Automate the copy step (recommended)
• Add a script to packages/agent/package.json so deploy is one command:
◦ Example:
▪︎ "deploy": "cp ../../../pnpm-lock.yaml . && lk agent create"
◦ Run with pnpm: pnpm -F @acme/agent deploy
Safety notes
• Avoid copying the entire monorepo into the Docker build context unless you add a strict .dockerignore. Copying the whole repo is inefficient and can expose more files than needed.
• Keep the lockfile in sync: if you update dependencies at root, remember to update the copied lockfile before building.
If you’d like, I can help with one of the following:
• Provide a small script example that prepares a minimal build folder for lk agent create.
• Show a safe Dockerfile snippet plus a recommended .dockerignore.
• Help debug any additional errors that appear after adding the lockfile (e.g., pnpm install errors, missing build scripts, or environment variable issues).
Which would you like to do next, or can you paste the exact Dockerfile error you see after trying the copy?
Sources: Examples | livekit/livekit_composite | DeepWiki