serverlesspub/imagemagick-aws-lambda-2

[SUGGESTION] Removing lib before make deploy could reduce size of the layer drastically

prcongithub opened this issue · 0 comments

I tried this in my app but the size of the function was exceeding 262MB limit. So I dug deeper into the Makefile to see what all it includes in the final layer.zip. I saw that the lib, etc, include and share directories along with the bin folder were included. I wondered if we really needed those and tried this:

build/layer.zip: result/bin/identify build
	# imagemagick has a ton of symlinks, and just using the source dir in the template
	# would cause all these to get packaged as individual files. 
	# (https://github.com/aws/aws-cli/issues/2900) 
	#
	# This is why we zip outside, using -y to store them as symlinks
	
	cd result && rm -rf lib && zip -ry $(PROJECT_ROOT)$@ *

With this the size of the result folder was brought down to 19 MB from 55 MB.
This seems to be working fine with the function I use it in.

Any thoughts?