Skip to content

fix(docker): keep devDependencies out of production image#84

Merged
iamlukethedev merged 2 commits into
mainfrom
cursor/production-image-devdependencies-5d72
Apr 5, 2026
Merged

fix(docker): keep devDependencies out of production image#84
iamlukethedev merged 2 commits into
mainfrom
cursor/production-image-devdependencies-5d72

Conversation

@iamlukethedev
Copy link
Copy Markdown
Owner

Summary

  • add a production-focused multi-stage Dockerfile
  • install prod-only dependencies in deps with npm ci --ignore-scripts --omit=dev
  • install full deps separately in builder so npm run build still succeeds
  • copy node_modules for runtime from deps (prod-only) instead of from builder

Issue verification

The reported issue is valid for the Dockerfile introduced in PR #82 (add-dockerfile):

  • deps ran npm ci --ignore-scripts without --omit=dev
  • runner copied node_modules from builder

That means devDependencies (Playwright, Vitest, ESLint, jsdom, etc.) ended up in the production image, increasing size and attack surface.

Result

The final runner image now contains only production dependencies while preserving a full dependency set where required for building.

Testing

  • Verified Dockerfile stage wiring and copy sources so runtime receives prod-only node_modules.
Open in Web Open in Cursor 

Co-authored-by: Luke The Dev <iamlukethedev@users.noreply.github.com>
@iamlukethedev iamlukethedev marked this pull request as ready for review April 5, 2026 03:23
@iamlukethedev iamlukethedev merged commit bed92c2 into main Apr 5, 2026
1 check passed
@iamlukethedev iamlukethedev deleted the cursor/production-image-devdependencies-5d72 branch April 5, 2026 03:24
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.

3 participants