kkarimi / lambda-layer-sharp

An AWS lambda layer with pre-built sharp node module optimised for minimal layer size

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AWS Sharp layer

This AWS lambda layer contains a pre-built sharp npm library. It is optimized for the most frugal space usage possible.

Getting

A pre-built layer zip file is available on the Releases page, alongside the size of the layer.

Building

Dependencies

  • Docker

Steps

  1. Clone the repo:
    git clone git@github.com:Umkus/lambda-layer-sharp.git
    cd lambda-layer-sharp/
  2. Install dependencies:
    docker run -v "$PWD":/var/task lambci/lambda:build-nodejs12.x npm --no-optional --no-audit --progress=false install
  3. Build the layer:
    docker run -v "$PWD":/var/task lambci/lambda:build-nodejs12.x node ./node_modules/webpack/bin/webpack.js
  4. Perform a smoke-test:
    docker run -w /var/task/dist/nodejs -v "$PWD":/var/task lambci/lambda:build-nodejs12.x node -e "console.log(require('sharp'))"
  5. Import created layer into your AWS account:
    aws lambda publish-layer-version --layer-name sharp --description "Sharp layer" --license-info "Apache License 2.0" --zip-file fileb://dist/sharp-layer.zip --compatible-runtimes nodejs12.x

About

An AWS lambda layer with pre-built sharp node module optimised for minimal layer size


Languages

Language:JavaScript 75.1%Language:Dockerfile 24.9%