-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reduce package size with bundling #51
Comments
WOW, coming from the Ruby side where it is a simple gem install with no system dependencies needed, this feels like something worth doing. Maybe at the least the README here should speak more to a docker multi-staage build/installation approach? |
That’s the ideal solution, hopefully this PR will be merged #8 and all native dependencies can be removed.
While multi-stage builds are possible, I find there are drawbacks too. I have to spend much more compute time building the image (especially if I’m using the ARM architecture), and frameworks like serverless still upload all stages to AWS’s ECR service, which can be upwards of 4 gigs with the multi-stage builds.
That’s an interesting approach, using GitHub Actions to publish containers you can copy from to avoid building from scratch every time. Unfortunately, there’s still the issue of #44 (comment), which means that the nodejs runtime interface client differs depending on whether you use docker containers or not (and prevents using ES Modules in the docker version). Using the new AWS Linux 2022 is nice, but getting the right version of NodeJS installed is not straightforward nodesource/distributions#1367 (comment) @metaskills anyway, watch out for those hidden gotcha’s. I ended up building my own system to manage NodeJS C++ addons too. |
Yup, but given the age I might have to solution something as well.
Fun fact, I do the same here for this Rust-based Lambda Extension https://github.com/customink/crypteia#installation and I think I can do something similar for our Ubuntu images. |
This is fixed in #70. |
On https://github.com/fromtheexchange/aws-lambda-ric, I bundled
aws-lambda-ric
with@vercel/ncc
to reduce the package size from128M
to688K
. Bundling reduced my final image size by 25%.The text was updated successfully, but these errors were encountered: