Skip to content

Conversation

@drewstone
Copy link
Contributor

Summary

  • Pre-populate npm, cargo, and pip caches during Docker image build time for significantly faster first-time package installations
  • Add generateCacheWarmCommands() function to generate_docker.js supporting npm, cargo, and pip cache warming
  • Add cache_warm configuration field to config.json for per-project cache warming

Changes

File Description
base/base-system.Dockerfile npm cache add for ~25 common packages (React, Next, Vite, TypeScript, testing, styling, utilities)
intermediate/rust.Dockerfile cargo fetch for common crates (tokio, serde, anyhow, reqwest, clap, etc.)
generate_docker.js New generateCacheWarmCommands() function with npm/cargo/pip support
config.json Updated rust template + cache_warm configs for ethereum, solana, tangle, universal, langchain

Expected Impact

Scenario Before After
npm install react ~5-10s <1s
npm create vite ~15-20s ~2-3s
cargo build (new project with tokio/serde) ~60s ~10s

Test plan

  • Build base-system image and verify npm cache contains pre-warmed packages
  • Build rust intermediate image and verify cargo registry is populated
  • Generate ethereum Dockerfile and verify cache_warm section is present
  • Generate combined project Dockerfile and verify cache_warm configs are merged

🤖 Generated with Claude Code

Pre-populate npm, cargo, and pip caches during Docker image build time
so that first-time package installations are significantly faster.

Changes:
- base-system.Dockerfile: npm cache add for ~25 common packages (React,
  Next, Vite, TypeScript, testing, styling, utilities)
- intermediate/rust.Dockerfile: cargo fetch for common crates (tokio,
  serde, anyhow, reqwest, clap, etc.)
- generate_docker.js: new generateCacheWarmCommands() function with
  support for npm, cargo, and pip cache warming in generated Dockerfiles
- config.json: updated rust template + added cache_warm configs to
  ethereum, solana, tangle, universal, and langchain projects

Expected impact:
- npm install react: ~5s → <1s
- npm create vite: ~15s → ~2s
- cargo build (new project): ~60s → ~10s

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@drewstone
Copy link
Contributor Author

@claude review

- Add chmod -R a+w $CARGO_HOME after cargo fetch to ensure cache files
  are writable by the project user (not just root)
- Add --break-system-packages flag to pip download for consistency with
  other pip commands and compatibility with newer pip versions

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@drewstone drewstone merged commit e011cf4 into main Jan 10, 2026
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.

2 participants