-
Notifications
You must be signed in to change notification settings - Fork 20
Remove git executable from Dockerfiles #142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThe changes update Dockerfiles for Go, Python, and Rust environments to ensure the Changes
Poem
Tip ⚡💬 Agentic Chat (Pro Plan, General Availability)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (3)
dockerfiles/python-3.13.Dockerfile (1)
3-4
: Handle absence ofgit
and clean up cache to slim the image.The
apk del git
command will break the build ifgit
isn’t installed in the base image. Additionally, removing the APK cache afterwards can significantly reduce the final image size.Apply a guarded removal and cache cleanup:
- RUN apk del git + RUN apk del git || true && \ + rm -rf /var/cache/apk/*dockerfiles/rust-1.85.Dockerfile (1)
15-16
: Clean up apt caches after removinggit
to reduce image size.
apt-get remove -y git
uninstalls the package but leaves behind metadata and cached lists. Purging configuration and clearing/var/lib/apt/lists/
will slim the final layer.Apply this diff to both purge and clean caches:
- RUN apt-get remove -y git + RUN apt-get remove -y git && \ + apt-get purge -y --auto-remove && \ + rm -rf /var/lib/apt/lists/*dockerfiles/go-1.24.Dockerfile (1)
18-19
: Guardgit
removal and clear APK cache for a smaller image.As with the Python environment, unconditionally running
apk del git
may fail ifgit
isn’t present. Clearing the APK cache after removal also helps reduce image footprint.- RUN apk del git + RUN apk del git || true && \ + rm -rf /var/cache/apk/*
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
dockerfiles/go-1.24.Dockerfile
(1 hunks)dockerfiles/python-3.13.Dockerfile
(1 hunks)dockerfiles/rust-1.85.Dockerfile
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (7)
- GitHub Check: test_course_definition / test (zig)
- GitHub Check: test_course_definition / test (kotlin)
- GitHub Check: test_course_definition / test (java)
- GitHub Check: test_course_definition / test (haskell)
- GitHub Check: test_course_definition / test (go)
- GitHub Check: test_course_definition / test (cpp)
- GitHub Check: test_course_definition / test (c)
@ryan-gang this won't work, we need Git installed for the test-runner to work (and I think we'll end up installing it again anyway: https://github.com/codecrafters-io/core/blob/bb27a7597f91704b4dc23d3fb6daafe5d5b91afb/app/lib/buildpack_dockerfile_processor.rb#L42). Let's do a tester-level patch instead, and just move the git executable to |
@ryan-gang It's also a not-so-robust solution, how would we ensure that every new language added follows this pattern? Would've expected something like a CI check |
Yep, I was aware of the dockerfile_processor thing. |
Eliminate the git executable from Dockerfiles to prevent test solutions from using it.
Summary by CodeRabbit