feat: updated dockerfile - #142
Conversation
WalkthroughThe Dockerfile now uses a named build stage and a separate Python 3.11 slim runtime stage. The runtime stage copies installed packages and executables, then checks ChangesDocker image build
Estimated code review effort: 2 (Simple) | ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@Dockerfile`:
- Around line 22-29: Create a dedicated non-root runtime user in the final
Docker stage, grant it access to the mounted input and output directories, and
set USER before the validation commands or CMD. Keep the existing readii and
imgtools validation commands intact while ensuring they execute under the new
user.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
| FROM python:3.11-slim as final | ||
|
|
||
| COPY --from=base /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages | ||
| COPY --from=base /usr/local/bin /usr/local/bin | ||
|
|
||
| # Check that the package is installed | ||
| RUN readii --help | ||
| RUN imgtools --help |
There was a problem hiding this comment.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
Run the final image as a non-root user.
The final stage has no USER instruction, so the runtime container runs as root. Create a dedicated user and set USER before the validation commands or CMD. Ensure mounted input and output directories are accessible to that user.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@Dockerfile` around lines 22 - 29, Create a dedicated non-root runtime user in
the final Docker stage, grant it access to the mounted input and output
directories, and set USER before the validation commands or CMD. Keep the
existing readii and imgtools validation commands intact while ensuring they
execute under the new user.
Source: Linters/SAST tools
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #142 +/- ##
=======================================
Coverage 76.15% 76.15%
=======================================
Files 41 41
Lines 2009 2009
=======================================
Hits 1530 1530
Misses 479 479 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary by CodeRabbit