Scripts to statically compile LibRSVG for AWS Lambda instances powered by Amazon Linux 2.x.
The rsvg
binary will be in /opt/bin/rsvg-convert
after linking the layer to a Lambda function.
The Lambda Layer ZIP can be found in Releases.
- Docker
- AWS command line utilities (just for deployment)
- Clone the repository
git clone github.com/bubblydoo/librsvg-lambda-layer
cd librsvg-lambda-layer
- Start Docker services and build image (this might take a while)
docker build . --target librsvg-layer -t amazon-linux-librsvg-layer
# docker build . --target librsvg -t amazon-linux-librsvg
# docker build . --target builder -t amazon-linux-librsvg-builder
- Copy zip to ./dist
docker run -v "$PWD/dist":/dist amazon-linux-librsvg-layer
- Inspect layer content
unzip -l dist/librsvg-layer.zip
- Deploy to AWS
aws lambda publish-layer-version \
--layer-name rsvg \
--description "Librsvg layer" \
--license-info "MIT License" \
--zip-file fileb://dist/librsvg-layer.zip \
--compatible-runtimes nodejs12.x
- Images with
xlink:href="file://
do not load properly. You can inline the files as adata://
uri as a workaround. - Only jpeg and png builtin loaders are enabled (for usage with
data://
), but more can be enabled inDockerfile
For more information, check out:
Hans Otto Wirtz https://github.com/hansottowirtz Gojko Adzic https://gojko.net
- These scripts: MIT
- Rsvg: https://github.com/GNOME/librsvg/blob/master/COPYING
- Contained libraries all have separate licenses, check the respective web sites for more information