Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/customink/ruby-vips-lambda
AWS Lambda Layer for Ruby Libvips Gem
https://github.com/customink/ruby-vips-lambda
aws aws-lambda image-processing lambda-layer libvips rails ruby ruby-on-rails vips
Last synced: about 1 month ago
JSON representation
AWS Lambda Layer for Ruby Libvips Gem
- Host: GitHub
- URL: https://github.com/customink/ruby-vips-lambda
- Owner: customink
- Archived: true
- Created: 2019-04-15T22:17:29.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-07-03T19:44:39.000Z (over 2 years ago)
- Last Synced: 2024-08-02T06:14:09.192Z (4 months ago)
- Topics: aws, aws-lambda, image-processing, lambda-layer, libvips, rails, ruby, ruby-on-rails, vips
- Language: Dockerfile
- Size: 25.4 KB
- Stars: 38
- Watchers: 42
- Forks: 14
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
- awesome-layers - `customink/ruby-vips-lambda`
README
# Ruby Libvips Lambda Layer
Are you using the [ruby-vips](https://github.com/libvips/ruby-vips) or [image_processing](https://github.com/janko/image_processing) gems with a Lambda microservice? Maybe you are using [Lamby](https://github.com/customink/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](https://aws.amazon.com/blogs/compute/working-with-aws-lambda-and-lambda-layers-in-aws-sam/) is just for you.
**[Lamby: Simple Rails & AWS Lambda Integration using Rack.](https://github.com/customink/lamby)**
## 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](https://github.com/orgs/customink/packages?repo_name=ruby-vips-lambda&q=layer) for a matching version number. For example:
```dockerfile
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](https://sharp.pixelplumbing.com/install) for full details.
## Methodology
Simplicity, isolation, and compact! We followed the [docs](https://libvips.github.io/libvips/install.html) for `libvips` install. Our build script uses `public.ecr.aws/sam/build-nodejs16.x` Docker image from the [Amazon ECR Public Gallery](https://gallery.ecr.aws) 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.
```shell
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](https://github.com/orgs/customink/packages?repo_name=ruby-vips-lambda&q=layer)