Skip to content

Switch .dockerignore to whitelist-only approach#605

Open
akostadinov-bot[bot] wants to merge 2 commits into
masterfrom
fix-dockerignore
Open

Switch .dockerignore to whitelist-only approach#605
akostadinov-bot[bot] wants to merge 2 commits into
masterfrom
fix-dockerignore

Conversation

@akostadinov-bot

Copy link
Copy Markdown

Summary

  • The previous blocklist .dockerignore was too permissive — the production image contained .git (8.8MB), .env (with credentials), .idea, .circleci, coverage/ (with stale SimpleCov data from a developer's machine), and other artifacts
  • Switch to deny-by-default: ignore everything, explicitly allow only what the app needs at runtime (.s2i, app, bin, config, db, lib, public, vendor, Gemfile*, config.ru, Rakefile)

Context

Discovered while investigating why qlty coverage validation was failing — the CI builder image had a stale coverage/.resultset.json with paths from a developer's local machine (/home/dmayorov/...) baked in from a previous docker build.

Test plan

  • Verify docker-build CI job still passes (builds image and runs rails db:setup)
  • Verify the built image can boot and serve requests

🤖 Generated with Claude Code

@akostadinov-bot
akostadinov-bot Bot force-pushed the fix-dockerignore branch 6 times, most recently from ae6e731 to bb0d086 Compare July 17, 2026 18:22
@qltysh

qltysh Bot commented Jul 17, 2026

Copy link
Copy Markdown

Qlty


Coverage Impact

This PR will not change total coverage.

🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

.dockerignore: switch to whitelist-only approach. The previous blocklist
was too permissive — the production image contained .git (8.8MB), .env
(with credentials), .idea, .circleci, coverage/ (with stale SimpleCov
data from a developer's machine), and other artifacts.

Dockerfile: stop pinning UBI to a specific minor version (was 9.6,
latest is 9.8). Using ubi9:9 tracks the latest 9.x minor.

CI config: change working_directory from /opt/app-root/src to
/opt/app-root/src/ci so CircleCI checkout works even without .git in
the image. Point bundler to the original vendor/bundle path to reuse
cached and image gems.

Assisted-By: claude-opus-4-6
@akostadinov

Copy link
Copy Markdown
Contributor

btw this is not tested, so I have to test it before merging. But wanted to get your opinion first.

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