Fix Kaniko layer cache miss on bundle install #153
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "152-fix-kaniko-cache-bust"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
COPY vendor/* ./vendor/copied CI-installed gems into the build context, butbundle installuses$BUNDLE_PATHfrom the base image — the copied gems were never used and invalidated Kaniko's layer cache on every build/vendor/bundleto.dockerignoreas a safety netCloses #152
Changes
Dockerfile: RemovedCOPY vendor/* ./vendor/(line 7) — eliminates the cache-busting layer.dockerignore: Added/vendor/bundle— prevents CI gems from entering the build contextTest Plan
Review Checklist
152-fix-kaniko-cache-bust)Related Notes
QA Review -- PR #153
Scope check: 2 files changed (Dockerfile, .dockerignore), 3 additions, 1 deletion. Changes match issue #152 exactly. No extraneous modifications.
Findings
Dockerfile --
COPY vendor/* ./vendor/removalbundle installuses$BUNDLE_PATHfrom the base image, not./vendor/bundle. The removed line copied CI-installed gems that were never used by the Docker build, and their changing contents invalidated Kaniko's layer cache on every pipeline run.COPY Gemfile Gemfile.lock ./beforebundle installis the correct pattern -- Kaniko can now cache the bundle install layer when Gemfile/Gemfile.lock are unchanged..dockerignore --
/vendor/bundleadditionCOPY . .on Dockerfile line 14 would otherwise pull CI gems into the build context. The.dockerignoreentry prevents this even if someone removes the line or changes the Dockerfile structure later.No issues found
bundle installhandles gem installation from Gemfile.lock152-fix-kaniko-cache-bust)Closes #152referenceVERDICT: APPROVE