Skip to content

Commit 7f7c181

Browse files
authored
Add Nodejs 16 (#210)
Adding Nodejs 16.13 runtime
1 parent ff3698b commit 7f7c181

File tree

12 files changed

+284
-2
lines changed

12 files changed

+284
-2
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ deploy:
4242
all_branches: true
4343
repo: apache/openwhisk-runtime-nodejs
4444
- provider: script
45-
script: "./tools/travis/publish.sh openwhisk nodejs12Action nightly && ./tools/travis/publish.sh openwhisk nodejs14Action nightly && ./tools/travis/publish.sh openwhisk typescript37Action nightly"
45+
script: "./tools/travis/publish.sh openwhisk nodejs12Action nightly && ./tools/travis/publish.sh openwhisk nodejs14Action nightly && ./tools/travis/publish.sh openwhisk nodejs16Action nightly && ./tools/travis/publish.sh openwhisk typescript37Action nightly"
4646
on:
4747
branch: master
4848
repo: apache/openwhisk-runtime-nodejs

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ The following Node.js runtime versions (with kind & image labels) are generated
2828

2929
- Node.js 12.22.2 (`nodejs:12` & `openwhisk/action-nodejs-v12`)
3030
- Node.js 14.17.2 (`nodejs:14` & `openwhisk/action-nodejs-v14`)
31+
- Node.js 16.13.1 (`nodejs:16` & `openwhisk/action-nodejs-v16`)
3132

3233
This README documents the build, customisation and testing of these runtime images.
3334

@@ -49,12 +50,19 @@ wsk action update myAction myAction.js --kind nodejs:12
4950
wsk action update myAction myAction.js --kind nodejs:14
5051
```
5152

53+
### Node.js v16
54+
55+
```
56+
wsk action update myAction myAction.js --kind nodejs:16
57+
```
58+
5259
## Images
5360

5461
All the runtime images are published by the project to Docker Hub @ [https://hub.docker.com/u/openwhisk](https://hub.docker.com/u/openwhisk)
5562

5663
- [https://hub.docker.com/r/openwhisk/action-nodejs-v12](https://hub.docker.com/r/openwhisk/action-nodejs-v12)
5764
- [https://hub.docker.com/r/openwhisk/action-nodejs-v14](https://hub.docker.com/r/openwhisk/action-nodejs-v14)
65+
- [https://hub.docker.com/r/openwhisk/action-nodejs-v16](https://hub.docker.com/r/openwhisk/action-nodejs-v16)
5866

5967
These images can be used to execute Node.js actions on any deployment of Apache OpenWhisk, even those without those images defined the in runtime manifest, using the `--docker` action parameter.
6068

@@ -83,9 +91,10 @@ The `core/nodejsActionBase` folder contains the Node.js app server used to imple
8391
```
8492
./gradlew core:nodejs12Action:distDocker
8593
./gradlew core:nodejs14Action:distDocker
94+
./gradlew core:nodejs16Action:distDocker
8695
```
8796

88-
This will return the following runtime images with the following names: `action-nodejs-v12` and `action-nodejs-v14`.
97+
This will return the following runtime images with the following names: `action-nodejs-v12`, `action-nodejs-v14` and `action-nodejs-v16`.
8998

9099
### Testing
91100

@@ -103,6 +112,7 @@ This will return the following runtime images with the following names: `action-
103112
```
104113
./gradlew tests:dat:docker:nodejs12docker:distDocker
105114
./gradlew tests:dat:docker:nodejs14docker:distDocker
115+
./gradlew tests:dat:docker:nodejs16docker:distDocker
106116
```
107117

108118
- Run the project tests.

core/nodejs16Action/.dockerignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
*.*~
2+
*.yaml
3+
*.tmpl
4+
*.gradle
5+
.dockerignore
6+
.project
7+
.settings
8+
build.xml
9+
Dockerfile
10+
logs
11+
node_modules
12+
package-lock.json
13+
test.js

core/nodejs16Action/CHANGELOG.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<!--
2+
#
3+
# Licensed to the Apache Software Foundation (ASF) under one or more
4+
# contributor license agreements. See the NOTICE file distributed with
5+
# this work for additional information regarding copyright ownership.
6+
# The ASF licenses this file to You under the Apache License, Version 2.0
7+
# (the "License"); you may not use this file except in compliance with
8+
# the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#
18+
-->
19+
20+
# NodeJS 16 OpenWhisk Runtime Container
21+
22+
# Next Release
23+
24+
Changes:
25+
- Initial release with support for Node.js v1.16
26+
27+
Node.js version = [16.13.1](https://nodejs.org/en/blog/release/v16.13.1/)
28+
OpenWhisk version = [OpenWhisk v3.21.2](https://www.npmjs.com/package/openwhisk)

core/nodejs16Action/Dockerfile

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to You under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
FROM node:16.13-stretch
19+
20+
# Initial update and some basics.
21+
#
22+
RUN apt-get update && apt-get install -y \
23+
imagemagick \
24+
graphicsmagick \
25+
unzip \
26+
&& rm -rf /var/lib/apt/lists/*
27+
28+
# Add sources and copy the package.json to root container,
29+
# so npm packages from user functions take precedence.
30+
#
31+
WORKDIR /nodejsAction
32+
ADD . /nodejsAction/
33+
COPY package.json /
34+
35+
# Customize runtime with additional packages.
36+
# Install package globally so user packages can override.
37+
#
38+
RUN cd / && npm install --no-package-lock --production \
39+
&& npm cache clean --force
40+
41+
EXPOSE 8080
42+
43+
CMD node --expose-gc app.js

core/nodejs16Action/build.gradle

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
apply plugin: 'eclipse'
19+
eclipse {
20+
project {
21+
natures 'org.eclipse.wst.jsdt.core.jsNature'
22+
buildCommand 'org.eclipse.wst.jsdt.core.javascriptValidator'
23+
}
24+
}
25+
26+
ext.dockerImageName = 'action-nodejs-v16'
27+
apply from: '../../gradle/docker.gradle'
28+
29+
distDocker.dependsOn 'copyPackageJson'
30+
distDocker.dependsOn 'copyProxy'
31+
distDocker.dependsOn 'copyRunner'
32+
distDocker.dependsOn 'copyService'
33+
distDocker.dependsOn 'copyPlatform'
34+
distDocker.dependsOn 'copyOpenWhisk'
35+
distDocker.dependsOn 'copyKnative'
36+
distDocker.dependsOn 'copyBuildTemplate'
37+
distDocker.finalizedBy('cleanup')
38+
39+
task copyPackageJson(type: Copy) {
40+
from '../nodejsActionBase/package.json'
41+
into '.'
42+
}
43+
44+
task copyProxy(type: Copy) {
45+
from '../nodejsActionBase/app.js'
46+
into '.'
47+
}
48+
49+
task copyRunner(type: Copy) {
50+
from '../nodejsActionBase/runner.js'
51+
into '.'
52+
}
53+
54+
task copyService(type: Copy) {
55+
from '../nodejsActionBase/src/service.js'
56+
into './src'
57+
}
58+
59+
task copyPlatform(type: Copy) {
60+
from '../nodejsActionBase/platform/platform.js'
61+
into './platform'
62+
}
63+
64+
task copyOpenWhisk(type: Copy) {
65+
from '../nodejsActionBase/platform/openwhisk.js'
66+
into './platform'
67+
}
68+
69+
task copyKnative(type: Copy) {
70+
from '../nodejsActionBase/platform/knative.js'
71+
into './platform'
72+
}
73+
74+
task copyBuildTemplate(type: Copy) {
75+
from '../nodejsActionBase/buildtemplate.yaml'
76+
into '.'
77+
}
78+
79+
task cleanup(type: Delete) {
80+
delete 'package.json'
81+
delete 'app.js'
82+
delete 'runner.js'
83+
delete 'src'
84+
delete 'platform'
85+
delete 'buildtemplate.yaml'
86+
}

settings.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@ include 'tests'
2020
include 'core:nodejsActionBase'
2121
include 'core:nodejs12Action'
2222
include 'core:nodejs14Action'
23+
include 'core:nodejs16Action'
2324
include 'core:typescript37Action'
2425
include 'tests:dat:docker:nodejs12docker'
2526
include 'tests:dat:docker:nodejs14docker'
27+
include 'tests:dat:docker:nodejs16docker'
2628
include 'tests:dat:docker:typescript37docker'
2729

2830
rootProject.name = 'runtime-nodejs'
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to You under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
FROM action-nodejs-v16
18+
COPY package.json .
19+
RUN npm install --production
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
ext.dockerImageName = 'nodejs16docker'
19+
apply from: '../../../../gradle/docker.gradle'
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "testdocker",
3+
"version": "1.0.0",
4+
"main": "index.js",
5+
"dependencies": {
6+
"openwhisk": "2.0.0"
7+
}
8+
}

0 commit comments

Comments
 (0)