This AWS Lambda layer contains a pre-built Sharp binary. New releases are automatically published in this repository on each Sharp update.
A pre-built layer zip file is available on the Releases page, alongside the size of the layer. Zip files for both x86_64 and arm64 are available.
- Docker
- Clone the repo:
git clone [email protected]:bubblydoo/lambda-layer-sharp.git cd lambda-layer-sharp/
- Install dependencies:
docker run -v "$PWD":/var/task lambci/lambda:build-nodejs12.x npm --no-optional --no-audit --progress=false install
- Build the layer:
docker run -v "$PWD":/var/task lambci/lambda:build-nodejs12.x node ./node_modules/webpack/bin/webpack.js
- 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'))"
- 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
The build Github Action is automatically triggered by Dependabot, merged by Mergify and then published by the same Github Action.
Originally forked from Umkus/lambda-layer-sharp.