Skip to content

Commit 78963c7

Browse files
committed
add v1.2 with latest dependencies and updated build process
1 parent b80d765 commit 78963c7

File tree

4 files changed

+17
-14
lines changed

4 files changed

+17
-14
lines changed

README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ AWS Lambda Layer providing [sharp](https://github.com/lovell/sharp) with HEIC (a
66
## Prerequisites
77

88
* Docker
9-
* [SAM](https://github.com/awsdocs/aws-sam-developer-guide/blob/master/doc_source/serverless-sam-cli-install.md)
9+
* [SAM v1.22.0 or higher](https://github.com/awsdocs/aws-sam-developer-guide/blob/master/doc_source/serverless-sam-cli-install.md)
1010

1111
## Usage
1212

@@ -52,10 +52,13 @@ The special value `account` for `PRINCIPAL` is used to give access to the accoun
5252
The environment variables are used to create a `samconfig.toml` file that configures the `sam package` and `sam deploy` commands.
5353

5454
### Note regarding build process
55-
The build process uses docker images from [lambci](https://hub.docker.com/r/lambci/lambda). AWS SAM CLI has a breaking change starting in v1 that sets the docker image for the build process to `amazon/aws-sam-cli-build-image-nodejs12.x` which is an image that is stripped down too much to make it useful to build anything (missing many dependencies to compile things, missing yum). The workaround for this is to use the `lambci/lambda:build-nodejs12.x` image and retag it as `amazon/aws-sam-cli-build-image-nodejs12.x`. Please note that this might affect your other build processes. It is therefore recommended to build this repo in an isolated environment such as AWS CodeBuild.
55+
This requires `sam-cli` version `v1.22.0` or higher in order to use the `--build-image` option.
56+
57+
The default build image for sam-cli is `public.ecr.aws/sam/build-nodejs12.x` which is an image that is stripped down too much to make it useful to build anything (missing many dependencies to compile things, missing yum). The workaround for this is to use the `lambci/lambda:build-nodejs12.x` image.
5658

5759
As Docker Hub introduced rate limits for public pulls, the `lambci/lambda:build-nodejs12.x` often can't be used from within AWS CodeBuild. The image has therefore been repulished in the public AWS ECR registry as `public.ecr.aws/n8r6f1x4/lambci-temporary:build-nodejs12.x`.
5860

61+
In order to pull the image from AWS ECR you might have to login to ECR using the command: `aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/n8r6f1x4`
5962

6063
## Background
6164
This repo exists as it is rather painful to compile all libraries required to get sharp to work with HEIC/HEIF files in an AWS Lambda environment. The sharp repository has several [issues](https://github.com/lovell/sharp/issues) related to this.
@@ -66,9 +69,10 @@ This lambda layer contains the node module [sharp](https://github.com/lovell/sha
6669

6770
### Dependencies
6871
The following table lists the release version of this repo together with the version of each dependency
69-
| release | sharp | libvips | libheif | libwebp | libde265 |
70-
|---------|--------|---------|---------|---------|----------|
71-
| 1.1.0 | 0.27.0 | 8.10.5 | 1.10.0 | 1.1.0 | 1.0.8 |
72+
| release | sharp | libvips | libheif | libwebp | libde265 | nodejs |
73+
|---------|--------|---------|---------|---------|----------|--------|
74+
| 1.1.0 | 0.27.0 | 8.10.5 | 1.10.0 | 1.1.0 | 1.0.8 | 12 |
75+
| 1.2.0 | 0.28.2 | 8.10.6 | 1.12.0 | 1.2.0 | 1.0.8 | 12 |
7276

7377
### CompatibleRuntimes
7478
- `nodejs12.x`

layer/Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Library Versions
2-
WEBP_VERSION=1.1.0
2+
WEBP_VERSION=1.2.0
33
LIBDE265_VERSION=1.0.8
4-
LIBHEIF_VERSION=1.10.0
5-
VIPS_VERSION=8.10.5
6-
SHARP_VERSION=0.27.0
4+
LIBHEIF_VERSION=1.12.0
5+
VIPS_VERSION=8.10.6
6+
SHARP_VERSION=0.28.2
77

88
PREFIX_PATH=/opt
99

layer/src/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sharp-heic",
3-
"version": "1.0.0",
3+
"version": "1.2.0",
44
"description": "",
55
"main": "index.js",
66
"scripts": {},
@@ -11,6 +11,6 @@
1111
"node": ">=12.0"
1212
},
1313
"dependencies": {
14-
"sharp": "^0.27.0"
14+
"sharp": "^0.28.2"
1515
}
1616
}

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
{
22
"name": "sharp-heic-lambda-layer",
3-
"version": "1.1.0",
3+
"version": "1.2.0",
44
"description": "Lambda Layer providing sharp with HEIC support",
55
"main": "index.js",
66
"scripts": {
77
"test": "npm run lint",
88
"lint": "npx eslint .",
99
"lint:fix": "npx eslint --fix .",
10-
"prebuild": "docker pull public.ecr.aws/n8r6f1x4/lambci-temporary:build-nodejs12.x && docker tag public.ecr.aws/n8r6f1x4/lambci-temporary:build-nodejs12.x amazon/aws-sam-cli-build-image-nodejs12.x",
11-
"build": "sam build --use-container --skip-pull-image",
10+
"build": "sam build --use-container --build-image public.ecr.aws/n8r6f1x4/lambci-temporary:build-nodejs12.x",
1211
"prepackage": "node deployment/createSAMConfiguration.js > samconfig.toml",
1312
"package": "sam package",
1413
"predeploy": "npm run package",

0 commit comments

Comments
 (0)