Skip to content

How to reduce the size of the built Docker container #13137

Answered by GabenGar
digibake asked this question in Q&A
Discussion options

You must be logged in to vote

Yeah you can do that by basically writing your own bundler. Do note however majority of dependencies for server code, aka nodejs code, are either written in CJS or transpiled to it, so that makes them statically non-analyzable. Plus all the weird stuff with native dependencies.
As for Bun, have you looked at the final size of the executable? Nodejs compilation resulted in a 100mb executable on me for just a lib handling CLI with just one command. Granted it depended on fs which in turn had to pull an entirety of libuv along. I strongly doubt Bun has a bigger wiggle room in this regard.
The size of dependencies in general is not a problem for server world, that's why server code is written…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@digibake
Comment options

@GabenGar
Comment options

Answer selected by digibake
@digibake
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants