@@ -159,6 +159,14 @@ if [[ -z $NO_PROMPT ]]; then
159
159
done
160
160
fi
161
161
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
+
162
170
echo Will build Lambda layer with name \" $LAYER_NAME \" .
163
171
164
172
if [[ -z $SKIP_DOCKER_IMAGE ]]; then
@@ -338,7 +346,7 @@ if [[ -z $SKIP_AWS_PUBLISH_LAYER ]]; then
338
346
--license-info $LICENSE \
339
347
--zip-file fileb://$ZIP_NAME \
340
348
--output json \
341
- --compatible-runtimes nodejs18.x nodejs20.x nodejs22.x \
349
+ --compatible-runtimes $SUPPORTED_RUNTIMES \
342
350
| jq ' .Version' \
343
351
) || true # NOTE: If the upload fails, the bash script should not fail.
344
352
@@ -372,8 +380,10 @@ else
372
380
fi
373
381
374
382
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 "
377
387
378
388
# NOTE: serverless/ci/pipeline.yaml passes PACKAGE_VERSION=1 for 1.x branch
379
389
if [[ $PACKAGE_VERSION == latest ]]; then
0 commit comments