Skip to content
This repository was archived by the owner on Jan 15, 2023. It is now read-only.

Commit e358485

Browse files
committed
Add nodejs12.x runtime
1 parent 1e51df4 commit e358485

File tree

9 files changed

+88
-8
lines changed

9 files changed

+88
-8
lines changed

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ You can also use [yumda](https://github.com/lambci/yumda) to install precompiled
6060
## Run Examples
6161

6262
```sh
63-
# Test an index.handler function from the current directory on Node.js v10.x
64-
docker run --rm -v "$PWD":/var/task lambci/lambda:nodejs10.x index.handler
63+
# Test an index.handler function from the current directory on Node.js v12.x
64+
docker run --rm -v "$PWD":/var/task lambci/lambda:nodejs12.x index.handler
6565

6666
# If using a function other than index.handler, with a custom event
67-
docker run --rm -v "$PWD":/var/task lambci/lambda:nodejs10.x index.myHandler '{"some": "event"}'
67+
docker run --rm -v "$PWD":/var/task lambci/lambda:nodejs12.x index.myHandler '{"some": "event"}'
6868

6969
# Use the Node.js v8.10 runtime in a similar fashion
7070
docker run --rm -v "$PWD":/var/task lambci/lambda:nodejs8.10 index.myHandler '{}'
@@ -123,7 +123,7 @@ To use the build images, for compilation, deployment, etc:
123123

124124
```sh
125125
# To compile native deps in node_modules
126-
docker run --rm -v "$PWD":/var/task lambci/lambda:build-nodejs10.x npm rebuild
126+
docker run --rm -v "$PWD":/var/task lambci/lambda:build-nodejs12.x npm rebuild
127127

128128
# To resolve dependencies on go1.x (working directory is /go/src/handler)
129129
docker run --rm -v "$PWD":/go/src/handler lambci/lambda:build-go1.x go mod download
@@ -200,6 +200,7 @@ These follow the Lambda runtime names:
200200
- `nodejs6.10`
201201
- `nodejs8.10`
202202
- `nodejs10.x`
203+
- `nodejs12.x`
203204
- `python2.7`
204205
- `python3.6`
205206
- `python3.7`
@@ -213,6 +214,7 @@ These follow the Lambda runtime names:
213214
- `build-nodejs6.10`
214215
- `build-nodejs8.10`
215216
- `build-nodejs10.x`
217+
- `build-nodejs12.x`
216218
- `build-python2.7`
217219
- `build-python3.6`
218220
- `build-python3.7`

base/build-all.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
RUNTIMES="provided go1.x nodejs4.3 nodejs6.10 nodejs8.10 nodejs10.x python2.7 python3.6 python3.7 ruby2.5 java8 dotnetcore2.0 dotnetcore2.1"
3+
RUNTIMES="provided go1.x nodejs4.3 nodejs6.10 nodejs8.10 nodejs10.x nodejs12.x python2.7 python3.6 python3.7 ruby2.5 java8 dotnetcore2.0 dotnetcore2.1"
44

55
TOP_DIR="${PWD}/.."
66

base/diff-2.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
RUNTIMES="nodejs10.x"
3+
RUNTIMES="nodejs10.x nodejs12.x"
44

55
rm -rf diff-2
66
mkdir -p diff-2
@@ -39,3 +39,9 @@ echo
3939
diff docker/var/runtime lambda/var/runtime
4040
echo
4141
diff -qr docker lambda
42+
43+
cd ${DIFF_DIR}/nodejs12.x
44+
pwd
45+
diff docker/var/runtime lambda/var/runtime
46+
diff -qr docker lambda
47+
echo

base/dump-node12x.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
const fs = require('fs')
2+
const { execSync } = require('child_process')
3+
const AWS = require('aws-sdk')
4+
const s3 = new AWS.S3()
5+
6+
// Depends on tar-find-layer for the tar/find/xargs binaries
7+
exports.handler = async(event, context) => {
8+
const execOpts = { stdio: 'inherit', maxBuffer: 16 * 1024 * 1024 }
9+
10+
let filename = 'nodejs12.x.tgz'
11+
let cmd = 'tar -cpzf /tmp/' + filename +
12+
' --numeric-owner --ignore-failed-read /var/runtime /var/lang /var/rapid'
13+
14+
execSync(cmd, execOpts)
15+
16+
console.log('Zipping done! Uploading...')
17+
18+
let data = await s3.upload({
19+
Bucket: 'lambci',
20+
Key: 'fs/' + filename,
21+
Body: fs.createReadStream('/tmp/' + filename),
22+
ACL: 'public-read',
23+
}).promise()
24+
25+
console.log('Uploading done!')
26+
27+
console.log(process.execPath)
28+
console.log(process.execArgv)
29+
console.log(process.argv)
30+
console.log(process.cwd())
31+
console.log(__filename)
32+
console.log(process.env)
33+
execSync('echo /proc/1/environ; xargs -n 1 -0 < /proc/1/environ', execOpts)
34+
execSync("bash -O extglob -c 'for cmd in /proc/+([0-9])/cmdline; do echo $cmd; xargs -n 1 -0 < $cmd; done'", execOpts)
35+
console.log(context)
36+
37+
return data
38+
}

base/publish-all.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
RUNTIMES="provided go1.x nodejs4.3 nodejs6.10 nodejs8.10 nodejs10.x python2.7 python3.6 python3.7 ruby2.5 java8 dotnetcore2.0 dotnetcore2.1"
3+
RUNTIMES="provided go1.x nodejs4.3 nodejs6.10 nodejs8.10 nodejs10.x nodejs12.x python2.7 python3.6 python3.7 ruby2.5 java8 dotnetcore2.0 dotnetcore2.1"
44

55
echo -n "Enter repository passphrase: "
66
read -s DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE

base/tag-all.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
RUNTIMES="provided go1.x nodejs4.3 nodejs6.10 nodejs8.10 nodejs10.x python2.7 python3.6 python3.7 ruby2.5 java8 dotnetcore2.0 dotnetcore2.1"
3+
RUNTIMES="provided go1.x nodejs4.3 nodejs6.10 nodejs8.10 nodejs10.x nodejs12.x python2.7 python3.6 python3.7 ruby2.5 java8 dotnetcore2.0 dotnetcore2.1"
44

55
git tag -f latest
66

base/test-all.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ docker run --rm -v "$PWD":/var/task lambci/lambda:nodejs8.10
1010
cd ${EXAMPLES_DIR}/nodejs8.10
1111
docker run --rm -v "$PWD":/var/task lambci/lambda:nodejs8.10
1212
docker run --rm -v "$PWD":/var/task lambci/lambda:nodejs10.x index.handler
13+
docker run --rm -v "$PWD":/var/task lambci/lambda:nodejs12.x index.handler
1314

1415
cd ${EXAMPLES_DIR}/nodejs-native-module
1516
npm run build

nodejs12.x/build/Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM lambci/lambda-base-2:build
2+
3+
ENV PATH=/var/lang/bin:$PATH \
4+
LD_LIBRARY_PATH=/var/lang/lib:$LD_LIBRARY_PATH \
5+
AWS_EXECUTION_ENV=AWS_Lambda_nodejs12.x \
6+
NODE_PATH=/opt/nodejs/node12/node_modules:/opt/nodejs/node_modules:/var/runtime/node_modules
7+
8+
RUN rm -rf /var/runtime /var/lang /var/rapid && \
9+
curl https://lambci.s3.amazonaws.com/fs/nodejs12.x.tgz | tar -zx -C /
10+
11+
# Add these as a separate layer as they get updated frequently
12+
RUN pip install -U awscli boto3 aws-sam-cli==0.31.0 aws-lambda-builders==0.5.0 --no-cache-dir

nodejs12.x/run/Dockerfile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
FROM lambci/lambda-base
2+
3+
RUN curl https://lambci.s3.amazonaws.com/fs/nodejs12.x.tgz | tar -zx -C /opt
4+
5+
6+
FROM lambci/lambda:provided
7+
8+
9+
FROM lambci/lambda-base-2
10+
11+
ENV PATH=/var/lang/bin:$PATH \
12+
LD_LIBRARY_PATH=/var/lang/lib:$LD_LIBRARY_PATH \
13+
AWS_EXECUTION_ENV=AWS_Lambda_nodejs12.x
14+
15+
COPY --from=0 /opt/* /var/
16+
17+
COPY --from=1 /var/runtime/init /var/rapid/init
18+
19+
USER sbx_user1051
20+
21+
ENTRYPOINT ["/var/rapid/init", "--bootstrap", "/var/runtime/bootstrap"]

0 commit comments

Comments
 (0)