Skip to content

Commit b7b5e4a

Browse files
committed
chore: updated the node.js version
1 parent 01147a9 commit b7b5e4a

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

packages/aws-lambda/layer/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# (c) Copyright IBM Corp. 2021
22
# (c) Copyright Instana Inc. and contributors 2021
33

4-
FROM public.ecr.aws/lambda/nodejs:22
4+
ARG NODEJS_VERSION
5+
FROM public.ecr.aws/lambda/nodejs:${NODEJS_VERSION}
56

67
WORKDIR /opt
78
COPY tmp/ .

packages/aws-lambda/layer/bin/publish-layer.sh

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,14 @@ if [[ -z $NO_PROMPT ]]; then
159159
done
160160
fi
161161

162+
# List of supported AWS Lambda Node.js runtimes
163+
SUPPORTED_RUNTIMES="nodejs18.x nodejs20.x nodejs22.x"
164+
165+
# The Node.js version to use for building the Docker image.
166+
# This should be aligned with one of the supported runtimes above.
167+
# We're using a development version.
168+
NODE_VERSION_TO_BUILD="20"
169+
162170
echo Will build Lambda layer with name \"$LAYER_NAME\".
163171

164172
if [[ -z $SKIP_DOCKER_IMAGE ]]; then
@@ -338,7 +346,7 @@ if [[ -z $SKIP_AWS_PUBLISH_LAYER ]]; then
338346
--license-info $LICENSE \
339347
--zip-file fileb://$ZIP_NAME \
340348
--output json \
341-
--compatible-runtimes nodejs18.x nodejs20.x nodejs22.x \
349+
--compatible-runtimes $SUPPORTED_RUNTIMES \
342350
| jq '.Version' \
343351
) || true # NOTE: If the upload fails, the bash script should not fail.
344352

@@ -372,8 +380,10 @@ else
372380
fi
373381

374382
if [[ -z $SKIP_DOCKER_IMAGE ]]; then
375-
echo "step 7/9: building docker image for container image based Lambda layer"
376-
docker build . -t "$DOCKER_IMAGE_NAME:$VERSION"
383+
echo "Step 7/9: Building Docker image for Lambda layer targeting Node.js version $NODE_VERSION_TO_BUILD"
384+
385+
# Build the Docker image for the specified Node.js version
386+
docker build --build-arg NODEJS_VERSION=$NODE_VERSION_TO_BUILD . -t "$DOCKER_IMAGE_NAME:$VERSION"
377387

378388
# NOTE: serverless/ci/pipeline.yaml passes PACKAGE_VERSION=1 for 1.x branch
379389
if [[ $PACKAGE_VERSION == latest ]]; then

0 commit comments

Comments
 (0)