Skip to content

Conversation

@Guiorgy
Copy link
Contributor

@Guiorgy Guiorgy commented Nov 20, 2025

In the Dockerfile in the app-builder stage the .git directory is copied:

COPY .git .git

And then later in the same stage it is supposedly removed:

# Build the JS vendor code in the app-builder, and then remove the vendor source.
RUN export CPPFLAGS="-DPNG_ARM_NEON_OPT=0" && \
    npm install -g corepack && \
    ... # skipped for brevity
    rm -rf node_modules \
           ... # skipped for brevity, attention to below VVV
           /pgadmin4/.git

I say supposedly, because the .git directory is copied into the filesystem root directory (/), whereas, the rest of the project files are inside the pgadmin4 directory, and the later command expects the .git directory to be inside it. Clearly a mistake, it was supposed to be copied into /pgadmin4/.git.

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:

Screanshot of the output of dive

With that being said, is the .git directory even needed during the build process? If not, it would be better to completely omit the copy to save on having to copy more than 366 MB (the size of .git as of writing) into the Docker image each time, which takes some time.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed the deployment/build process so repository files are copied and cleaned consistently, resolving build-time file-handling issues and improving reliability across environments.

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

@coderabbitai
Copy link

coderabbitai bot commented Nov 20, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Updated the Dockerfile COPY instruction to place the repository metadata at /pgadmin4/.git instead of copying .git to the repository root, matching downstream build and cleanup steps that reference the /pgadmin4/.git path.

Changes

Cohort / File(s) Change Summary
Docker build configuration
Dockerfile
Modified COPY of the .git directory to target /pgadmin4/.git rather than .git at the image root, aligning with subsequent build/cleanup steps that reference the /pgadmin4 path

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

  • Check Dockerfile for any other COPY or path assumptions still pointing to root .git
  • Verify build steps that remove or reference /pgadmin4/.git behave as expected

Possibly related PRs

  • Optimized Dockerfile #9378 — Also adjusts Dockerfile COPY operations and redirects repository files into /pgadmin4/, related to the same path-targeting change.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely describes the main change: fixing the .git copy destination in the Dockerfile to target /pgadmin4/.git instead of the root.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

📜 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 f4bff51 and cdefb5a.

📒 Files selected for processing (1)
  • Dockerfile (1 hunks)

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.

❤️ Share

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

@Guiorgy
Copy link
Contributor Author

Guiorgy commented Nov 20, 2025

The only possible benefit to copying the .git directory in the build process, that I can see, is to get and store the git revision/hash, but even that has much better ways of handling, such as passing it from the host as a build argument. do we really need to be copying the whole .git directory into the image? It wasn't even being correctly copied until now anyway :D

PS. Gotta love flaky tests :P

@akshay-joshi akshay-joshi merged commit 0132ce2 into pgadmin-org:master Dec 1, 2025
36 of 37 checks passed
@Guiorgy
Copy link
Contributor Author

Guiorgy commented Dec 1, 2025

@akshay-joshi as I asked previously, is the .git directory really needed for the following npm and yarn commands? I didn't get the answer, and am not a web dev, so I wouldn't know.

Ideally, we'd avoid copying the .git directory all together, which only keeps on growing, slowing the image build.

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