Skip to content

Conversation

@thespad
Copy link
Contributor

@thespad thespad commented Nov 29, 2025

Current image does two very inefficient operations:

  • It copies node_modules from shared-libs-builder stage to backend-builder stage and then in the runner stage copies node_modules from both stages again, even though the backend-builder stage now contains all the necessary modules.
  • It chowns the whole of /app after COPYing the files from previous stages

Both of these result in duplicating all of the affected files in the runner stage layers, which gives you about 600Mb of wasted space.

By removing the duplicate COPY of node_modules, and performing the chown as part of the COPY operation, that space can be free, reducing the image size substantially.

@coderabbitai
Copy link

coderabbitai bot commented Nov 29, 2025

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

@brendan-kellam
Copy link
Contributor

Thanks for the PR this is really great!! Heads up, I was hitting the following error when building locally:

ERROR: failed to solve: invalid chmod parameter: '+x'. it should be octal string and between 0 and 07777

It's probably because whatever bundled Dockerfile syntax version on my machine is less than version 1.14.0 where they introduced non-octal chmod params.

I think it would be best to add # syntax=docker/dockerfile:1 to the top of the Dockerfile such that we use the latest Dockerfile syntax. (docs)

@thespad
Copy link
Contributor Author

thespad commented Nov 29, 2025

Done. It's what I'd normally do when building a Dockerfile from scratch but I try not to assume too much when modifying other peoples' work.

Copy link
Contributor

@brendan-kellam brendan-kellam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you for this PR, it's super helpful!

@brendan-kellam brendan-kellam merged commit 41a6eb4 into sourcebot-dev:main Nov 29, 2025
4 of 5 checks passed
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