dockerfile-bundle-install-without-cache-mount
Warnings require a CI-discovered build with a recognized persistent builder path: Depot, configured Blacksmith, or repository-visible Buildkite local Docker state persistence. Unknown/disposable builders are not flagged for missing cache mounts.
Detects Ruby Dockerfiles that run bundle install without a visible BuildKit cache mount on the same instruction.
This rule looks for:
- a qualifying persistent Docker build discovered from GitHub Actions or Buildkite
Gemfilein the build contextRUN bundle install- no
--mount=type=cacheon that Dockerfile instruction
Why it matters:
- Bundler installs can download gems and compile native extensions.
- Without BuildKit cache mounts for Bundler caches, Docker rebuilds can repeatedly pay gem download and installation costs.
- Depot’s optimized Ruby Dockerfile mounts Bundler’s internal cache and the vendor cache during gem installation.
What to do:
- Add a BuildKit cache mount for
/usr/local/bundle/cacheto thebundle installstep. - If the Dockerfile uses
bundle cache, also consider mounting/app/vendor/cache. - Keep
GemfileandGemfile.lockcopied before broader source files when practical.
This rule focuses on Docker build cache behavior, not Rails runtime configuration.