aws/aws-lambda-nodejs-runtime-interface-client

reducing cURL dependency size

missinglink opened this issue · 3 comments

Heya,

I've been looking at reducing the size of images generated with this lib and found that 105M of the total 323M image size is being taken up by the curl-7.77.0 directory:

323M	/
105M	/code/node_modules/aws-lambda-ric/deps/curl-7.77.0

Within that dir there seem to be a bunch of files not required at runtime:

3.3M	/code/node_modules/aws-lambda-ric/deps/curl-7.77.0/autom4te.cache
1.3M	/code/node_modules/aws-lambda-ric/deps/curl-7.77.0/config.log
1.3M	/code/node_modules/aws-lambda-ric/deps/curl-7.77.0/configure
6.7M	/code/node_modules/aws-lambda-ric/deps/curl-7.77.0/docs
25M	/code/node_modules/aws-lambda-ric/deps/curl-7.77.0/lib
3.3M	/code/node_modules/aws-lambda-ric/deps/curl-7.77.0/projects
4.8M	/code/node_modules/aws-lambda-ric/deps/curl-7.77.0/src
56M	/code/node_modules/aws-lambda-ric/deps/curl-7.77.0/tests

I'm assuming it's not safe to just delete /code/node_modules/aws-lambda-ric/deps/curl-7.77.0?
... but presumably we could ditch some dirs such as curl-7.77.0/tests and the cache/log/configure/docs etc. files?

The following command helps reduce the image size significantly:

# https://github.com/aws/aws-lambda-nodejs-runtime-interface-client/issues/28
RUN rm -rf \
  node_modules/aws-lambda-ric/deps/curl-*/autom4te.cache \
  node_modules/aws-lambda-ric/deps/curl-*/config.log \
  node_modules/aws-lambda-ric/deps/curl-*/configure \
  node_modules/aws-lambda-ric/deps/curl-*/docs \
  node_modules/aws-lambda-ric/deps/curl-*/projects \
  node_modules/aws-lambda-ric/deps/curl-*/tests \
  node_modules/aws-lambda-ric/deps/curl-*/README
33M	/code/node_modules/aws-lambda-ric/deps/curl-7.77.0

This one seems pretty bonkers... Could it not just use a pre-installed libcurl and fail if its not available?

krk commented

This is fixed in #70.