Skip to content
This repository has been archived by the owner on Jun 24, 2024. It is now read-only.

customink/ruby-vips-lambda

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ruby Libvips Lambda Layer

Lamby: Simple Rails & AWS Lambda Integration using Rack.Are you using the ruby-vips or image_processing gems with a Lambda microservice? Maybe you are using Lamby to deploy your entire Rails application to AWS Lambda with its simple Rack integration? If yes to any of the above, this Lambda Layer is just for you.

Lamby: Simple Rails & AWS Lambda Integration using Rack.

Installation

This project assumes the use of Lambda Containers. It uses a bare alpine Docker image to distribute the /opt directory contents which can be installed easily within your project. Please browse this project's Layer Containers for a matching version number. For example:

FROM ghcr.io/customink/ruby-vips-lambda-layer:8.12.2.1 AS ruby-vips-lambda
FROM public.ecr.aws/lambda/ruby:2.7
COPY --from=ruby-vips-lambda /opt /opt

Amazon Linux 2

The master branch of this repo is targeted for the Amazon Linux 2. Most all dependencies needed for libvips have to be installed and packaged. Please reference sharp's installation instructions for full details.

Methodology

Simplicity, isolation, and compact! We followed the docs for libvips install. Our build script uses public.ecr.aws/sam/build-nodejs16.x Docker image from the Amazon ECR Public Gallery project as our build environment. All build commands are located in the Dockerfile which install all the dependencies for libvips in the /opt directory. This includes common file format openers and savers as well as libs that ensure libvips is fast. The current version built is 8.12.2 and easy to configure by providing the VIPS_VERSION environment variable during the build and deploy scripts.

Build

If you wanted to build your own /opt directory contents for a Lambda Layer usable by the ZIP packaging formation. You can build the project like so after cloning it. Make sure you have Docker installed.

VIPS_VERSION=8.12.2 PACKAGE_VERSION=1 ./bin/build

Contents

Current size of the layer's /opt directory is around around 32MB in size. To see view the contents, exec into one of the Layer Containers