Repository navigation
Enhancement: slim Docker image, add .dockerignore, fix Go binary shipping - #15880
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthroughThis PR reduces Docker build context with a new ChangesDocker Image Optimization
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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.
🧹 Nitpick comments (2)
Dockerfile (2)
46-47: ⚡ Quick winRuntime base still includes build/development packages.
Line 46 keeps
pkg-configandlibjemalloc-devinbase, which weakens the runtime-only split and adds image weight. Move build tooling tobuilder, and keep only runtime jemalloc libraries inbase.Proposed diff
- apt install -y \ - libglib2.0-0 libglx-mesa0 libgl1 pkg-config libgdiplus default-jdk libatk-bridge2.0-0 libgtk-4-1 libnss3 xdg-utils libjemalloc-dev gnupg unzip curl wget git vim less ghostscript pandoc texlive texlive-latex-extra texlive-xetex texlive-lang-chinese fonts-freefont-ttf fonts-noto-cjk postgresql-client && \ + apt install -y \ + libglib2.0-0 libglx-mesa0 libgl1 libgdiplus default-jdk libatk-bridge2.0-0 libgtk-4-1 libnss3 xdg-utils libjemalloc2 gnupg unzip curl wget git vim less ghostscript pandoc texlive texlive-latex-extra texlive-xetex texlive-lang-chinese fonts-freefont-ttf fonts-noto-cjk postgresql-client && \ @@ - apt install -y build-essential libpython3-dev libicu-dev libgbm-dev && \ + apt install -y build-essential pkg-config libpython3-dev libicu-dev libgbm-dev && \Also applies to: 145-148
🤖 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 46 - 47, The runtime image still installs build-time packages pkg-config and libjemalloc-dev; remove pkg-config and libjemalloc-dev from the runtime/base stage and install them only in the builder stage instead, while keeping the runtime jemalloc library (e.g., libjemalloc2 or the distro-specific non-dev jemalloc package) in base; update the builder stage package list to include pkg-config and libjemalloc-dev (and any other build tools needed) and remove dev packages from the runtime install lines referenced; ensure you also mirror this change for the later duplicate block (the other runtime install group) so only runtime libraries remain in base and all build tooling lives in builder.
169-170: ⚡ Quick winUse
npm cifor lockfile-based Docker builds.Line 170 uses
npm installeven thoughpackage-lock.jsonis copied.npm ciis typically faster and more deterministic for this layer.Proposed diff
RUN --mount=type=cache,id=ragflow_npm,target=/root/.npm,sharing=locked \ - cd web && NODE_OPTIONS="--max-old-space-size=8192" npm install + cd web && NODE_OPTIONS="--max-old-space-size=8192" npm ci🤖 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 169 - 170, The Dockerfile layer currently runs "npm install" in the web directory (the RUN line invoking cd web && NODE_OPTIONS="--max-old-space-size=8192" npm install) but should use lockfile-based install for reproducible builds; change the command to use "npm ci" instead while keeping the build cache mount (--mount=type=cache,id=ragflow_npm,target=/root/.npm,sharing=locked) and the NODE_OPTIONS env so the layer runs cd web && NODE_OPTIONS="--max-old-space-size=8192" npm ci.
🤖 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.
Nitpick comments:
In `@Dockerfile`:
- Around line 46-47: The runtime image still installs build-time packages
pkg-config and libjemalloc-dev; remove pkg-config and libjemalloc-dev from the
runtime/base stage and install them only in the builder stage instead, while
keeping the runtime jemalloc library (e.g., libjemalloc2 or the distro-specific
non-dev jemalloc package) in base; update the builder stage package list to
include pkg-config and libjemalloc-dev (and any other build tools needed) and
remove dev packages from the runtime install lines referenced; ensure you also
mirror this change for the later duplicate block (the other runtime install
group) so only runtime libraries remain in base and all build tooling lives in
builder.
- Around line 169-170: The Dockerfile layer currently runs "npm install" in the
web directory (the RUN line invoking cd web &&
NODE_OPTIONS="--max-old-space-size=8192" npm install) but should use
lockfile-based install for reproducible builds; change the command to use "npm
ci" instead while keeping the build cache mount
(--mount=type=cache,id=ragflow_npm,target=/root/.npm,sharing=locked) and the
NODE_OPTIONS env so the layer runs cd web &&
NODE_OPTIONS="--max-old-space-size=8192" npm ci.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: b841b961-2bc6-4dd5-b01b-a9ee2ddd1e1f
📒 Files selected for processing (2)
.dockerignoreDockerfile
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #15880 +/- ##
=======================================
Coverage 93.16% 93.16%
=======================================
Files 10 10
Lines 717 717
Branches 118 118
=======================================
Hits 668 668
Misses 29 29
Partials 20 20 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
What problem does this PR solve?
The RAGFlow Docker image was 9.06 GB with build-only compiler packages leaking into the runtime, duplicate frontend source shipped alongside compiled assets, and no .dockerignore causing ~6 GB of unnecessary context transfer per build.
Type of change