Skip to content

Commit 6dfb392

Browse files
committed
update to latest versions of dependencies and to nodejs14.x
1 parent 78963c7 commit 6dfb392

File tree

9 files changed

+247
-212
lines changed

9 files changed

+247
-212
lines changed

README.md

Lines changed: 5 additions & 9 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 v1.22.0 or higher](https://github.com/awsdocs/aws-sam-developer-guide/blob/master/doc_source/serverless-sam-cli-install.md)
9+
* [SAM v1.33.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,13 +52,7 @@ 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-
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.
58-
59-
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`.
60-
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`
55+
Previously, some custom docker images were needed to build this layer. AWS has since published newer images which work out of the box. `saml-cli` version `v1.33.0` is using `public.ecr.aws/sam/build-nodejs14.x:latest-x86_64`
6256

6357
## Background
6458
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.
@@ -73,9 +67,11 @@ The following table lists the release version of this repo together with the ver
7367
|---------|--------|---------|---------|---------|----------|--------|
7468
| 1.1.0 | 0.27.0 | 8.10.5 | 1.10.0 | 1.1.0 | 1.0.8 | 12 |
7569
| 1.2.0 | 0.28.2 | 8.10.6 | 1.12.0 | 1.2.0 | 1.0.8 | 12 |
70+
| 2.0.0 | 0.29.1 | 8.11.3 | 1.12.0 | 1.2.1 | 1.0.8 | 14 |
7671

7772
### CompatibleRuntimes
78-
- `nodejs12.x`
73+
- `nodejs12.x` (v1.x)
74+
- `nodejs14.x` (v2.x)
7975

8076

8177
## Contributions

buildspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ env:
99
phases:
1010
install:
1111
runtime-versions:
12-
nodejs: 12
12+
nodejs: 14
1313
pre_build:
1414
commands:
1515
- NODE_ENV=development npm ci

examples/src/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
"author": "Andreas Zoellner",
1010
"license": "MIT",
1111
"engines": {
12-
"node": ">=12.0"
12+
"node": ">=14.0"
1313
}
1414
}

examples/template.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Resources:
88
Properties:
99
CodeUri: ./src/
1010
Handler: index.handler
11-
Runtime: nodejs12.x
11+
Runtime: nodejs14.x
1212
Timeout: 10
1313
MemorySize: 1024
1414
Layers:

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.2.0
2+
WEBP_VERSION=1.2.1
33
LIBDE265_VERSION=1.0.8
44
LIBHEIF_VERSION=1.12.0
5-
VIPS_VERSION=8.10.6
6-
SHARP_VERSION=0.28.2
5+
VIPS_VERSION=8.11.3
6+
SHARP_VERSION=0.29.1
77

88
PREFIX_PATH=/opt
99

@@ -16,7 +16,7 @@ build-SharpHEICLayer: libvips
1616
# sharp uses several of the libs we installed or compiled. extract the full list and copy all of those into /opt/lib
1717
# extract list with ldd from sharp.node, manipulate a bit with sed to only get the absolute paths, then copy
1818
LD_LIBRARY_PATH=$(PREFIX_PATH)/lib npm --prefix "$(ARTIFACTS_DIR)/nodejs/" install sharp@$(SHARP_VERSION)
19-
ldd $(ARTIFACTS_DIR)/nodejs/node_modules/sharp/build/Release/sharp.node | sed -nE "s/^[^\/\n]*(\/[^ ]+)(.*)/\1/p" | xargs cp -t $(ARTIFACTS_DIR)/lib
19+
ldd $(ARTIFACTS_DIR)/nodejs/node_modules/sharp/build/Release/sharp-linux-x64.node | sed -nE "s/^[^\/\n]*(\/[^ ]+)(.*)/\1/p" | xargs cp -t $(ARTIFACTS_DIR)/lib
2020

2121
libwebp:
2222
curl -L https://github.com/webmproject/libwebp/archive/v$(WEBP_VERSION).tar.gz | tar zx

layer/src/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
"license": "MIT",
99
"devDependencies": {},
1010
"engines": {
11-
"node": ">=12.0"
11+
"node": ">=14.0"
1212
},
1313
"dependencies": {
14-
"sharp": "^0.28.2"
14+
"sharp": "^0.29.1"
1515
}
1616
}

package-lock.json

Lines changed: 229 additions & 190 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"test": "npm run lint",
88
"lint": "npx eslint .",
99
"lint:fix": "npx eslint --fix .",
10-
"build": "sam build --use-container --build-image public.ecr.aws/n8r6f1x4/lambci-temporary:build-nodejs12.x",
10+
"build": "sam build --use-container",
1111
"prepackage": "node deployment/createSAMConfiguration.js > samconfig.toml",
1212
"package": "sam package",
1313
"predeploy": "npm run package",
@@ -25,9 +25,9 @@
2525
},
2626
"homepage": "https://github.com/zoellner/sharp-heic-lambda-layer#readme",
2727
"engines": {
28-
"node": ">=12.0"
28+
"node": ">=14.0"
2929
},
3030
"devDependencies": {
31-
"eslint": "^7.17.0"
31+
"eslint": "^7.32.0"
3232
}
3333
}

template.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Resources:
2424
Description: Sharp Layer with HEIC Support
2525
ContentUri: ./layer/
2626
CompatibleRuntimes:
27-
- nodejs12.x
27+
- nodejs14.x
2828
LicenseInfo: 'MIT'
2929
RetentionPolicy: Retain
3030
Metadata:

0 commit comments

Comments
 (0)