Skip to content

Conversation

@Guiorgy
Copy link
Contributor

@Guiorgy Guiorgy commented Nov 20, 2025

In the app-builder stage we have the following:

# Create the /pgadmin4 directory and copy the source into it. Explicitly
# remove the node_modules directory as we'll recreate a clean version, as well
# as various other files we don't want
COPY web /pgadmin4/web
RUN rm -rf /pgadmin4/web/*.log \
           /pgadmin4/web/config_*.py \
           /pgadmin4/web/node_modules \
           /pgadmin4/web/regression \
           `find /pgadmin4/web -type d -name tests` \
           `find /pgadmin4/web -type f -name .DS_Store`

However, this is not the recommended way to exclude files in Docker, instead .dockerignore should be used, since the removed files would still be cached in the copy layer and the transfer would slow down the build process. This is especially puzzling since you do in fact already have and make use of the .dockerignore file:

web/node_modules
web/*.log
web/regression
web/**/tests/
web/**/*.pyc
web/**/__pycache__
.DS_Store
web/pgadmin/messages.pot
web/pgadmin/translations/??/LC_MESSAGES/messages.po
Dockerfile
docs/en_US/_build/**/*
src-build/**/*
dist/**/*

Using docker build --target app-builder --tag "pgadmin4:app-builder-stage" . to only build and export this stage, and then dive pgadmin4:app-builder-stage to explore the layers, I confirmed that the RUN rm -rf ... layer made no changes:

Screenshot of the output of the dive command

Thus, this instruction (and extra layer), along with the comment above, are completely useless. The only thing it might have done is remove /pgadmin4/web/config_*.py, although as seen from dive there were no such files, still, just in case, I added this pattern to .dockerignore`.

Summary by CodeRabbit

  • Chores
    • Updated Docker image build configuration and ignore patterns to preserve additional files and directories during the build process.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Nov 20, 2025

Walkthrough

The changes refactor Docker build artifact cleanup by replacing an explicit RUN rm -rf command in the Dockerfile with an exclusion pattern in .dockerignore. The new pattern web/config_*.py prevents matching files from being copied into the image during the build context transfer, eliminating the need for runtime cleanup.

Changes

Cohort / File(s) Summary
Docker build optimization
.dockerignore, Dockerfile
.dockerignore: Added web/config_*.py ignore pattern. Dockerfile: Removed cleanup command (RUN rm -rf ...) that previously deleted logs, config files, node_modules, regression directories, test directories, and .DS_Store files from /pgadmin4/web.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

  • Straightforward build configuration changes with minimal scope
  • Changes are complementary and clearly related (move cleanup responsibility from Dockerfile to .dockerignore)
  • No logic, control flow, or functional behavior modifications

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: removal of a RUN rm -rf layer from the Dockerfile app-builder stage, which aligns with the primary objective of simplifying the Dockerfile.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 482549b and bb469b2.

📒 Files selected for processing (2)
  • .dockerignore (1 hunks)
  • Dockerfile (0 hunks)
💤 Files with no reviewable changes (1)
  • Dockerfile
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: run-feature-tests-pg (17)
  • GitHub Check: run-feature-tests-pg (13)
  • GitHub Check: run-feature-tests-pg (15)
  • GitHub Check: run-feature-tests-pg (18)
  • GitHub Check: run-feature-tests-pg (16)
  • GitHub Check: run-feature-tests-pg (14)
🔇 Additional comments (1)
.dockerignore (1)

2-2: Pattern addition looks good.

The new web/config_*.py pattern correctly targets configuration files in the web directory and aligns with the PR objective of moving from runtime cleanup (RUN rm -rf) to build-time exclusion via .dockerignore. This follows Docker best practices, as excluded files never enter the layer cache, improving build efficiency.

The glob syntax is standard and will match configuration files like config_local.py, config_development.py, etc.

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


Comment @coderabbitai help to get the list of available commands and usage tips.

@khushboovashi khushboovashi merged commit d481507 into pgadmin-org:master Nov 24, 2025
37 checks passed
@Guiorgy Guiorgy deleted the simplify-dockerfile branch November 24, 2025 10:02
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