Closed fromtheexchange closed 1 year ago
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?
WOW, coming from the Ruby side where it is a simple gem install with no system dependencies needed
That’s the ideal solution, hopefully this PR will be merged https://github.com/aws/aws-lambda-nodejs-runtime-interface-client/pull/8 and all native dependencies can be removed.
Maybe at the least the README here should speak more to a docker multi-staage build/installation approach?
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 https://github.com/aws/aws-lambda-nodejs-runtime-interface-client/issues/44#issuecomment-1032928940, 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 https://github.com/nodesource/distributions/issues/1367#issuecomment-1199837646
@metaskills anyway, watch out for those hidden gotcha’s. I ended up building my own system to manage NodeJS C++ addons too.
hopefully this PR will be merged https://github.com/aws/aws-lambda-nodejs-runtime-interface-client/pull/8 and all native dependencies can be removed.
Yup, but given the age I might have to solution something as well.
That’s an interesting approach
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.
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%.