File tree 1 file changed +11
-3
lines changed
packages/aws-lambda/layer/bin 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -165,7 +165,15 @@ SUPPORTED_RUNTIMES="nodejs18.x nodejs20.x nodejs22.x"
165
165
# The Node.js version to use for building the Docker image.
166
166
# This should be aligned with one of the supported runtimes above.
167
167
# We're using a development version.
168
- NODE_VERSION_TO_BUILD=" 20"
168
+ ROOT_DIR=$( git rev-parse --show-toplevel 2> /dev/null || echo " ../../.." )
169
+ NVMRC_PATH=" $ROOT_DIR /.nvmrc"
170
+ if [[ -f " $NVMRC_PATH " ]]; then
171
+ NODEJS_DEV_VERSION=$( cat " $NVMRC_PATH " )
172
+ echo " Using Node.js version $NODEJS_DEV_VERSION from .nvmrc for Docker build"
173
+ else
174
+ echo " Warning: .nvmrc file not found at $NVMRC_PATH , falling back to default Node.js version 20"
175
+ NODEJS_DEV_VERSION=20
176
+ fi
169
177
170
178
echo Will build Lambda layer with name \" $LAYER_NAME \" .
171
179
@@ -380,10 +388,10 @@ else
380
388
fi
381
389
382
390
if [[ -z $SKIP_DOCKER_IMAGE ]]; then
383
- echo " Step 7/9: Building Docker image for Lambda layer targeting Node.js version $NODE_VERSION_TO_BUILD "
391
+ echo " Step 7/9: Building Docker image for Lambda layer targeting Node.js version $NODEJS_DEV_VERSION "
384
392
385
393
# 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 "
394
+ docker build --build-arg NODEJS_VERSION=$NODEJS_DEV_VERSION . -t " $DOCKER_IMAGE_NAME :$VERSION "
387
395
388
396
# NOTE: serverless/ci/pipeline.yaml passes PACKAGE_VERSION=1 for 1.x branch
389
397
if [[ $PACKAGE_VERSION == latest ]]; then
You can’t perform that action at this time.
0 commit comments