Skip to content

Commit 787d789

Browse files
authored
Initial Nodejs 20 Commit (#239)
1 parent 577ccbb commit 787d789

12 files changed

Lines changed: 276 additions & 0 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ jobs:
9292
./gradlew :core:nodejs16Action:distDocker -PdockerRegistry=docker.io -PdockerImagePrefix=openwhisk -PdockerImageTag=$SHORT_COMMIT
9393
./gradlew :core:nodejs18Action:distDocker -PdockerRegistry=docker.io -PdockerImagePrefix=openwhisk -PdockerImageTag=nightly
9494
./gradlew :core:nodejs18Action:distDocker -PdockerRegistry=docker.io -PdockerImagePrefix=openwhisk -PdockerImageTag=$SHORT_COMMIT
95+
./gradlew :core:nodejs20Action:distDocker -PdockerRegistry=docker.io -PdockerImagePrefix=openwhisk -PdockerImageTag=nightly
96+
./gradlew :core:nodejs20Action:distDocker -PdockerRegistry=docker.io -PdockerImagePrefix=openwhisk -PdockerImageTag=$SHORT_COMMIT
9597
- name: Push Release Images
9698
if: ${{ env.PUSH_RELEASE == 'true' }}
9799
working-directory: runtime

README.md

Lines changed: 3 additions & 0 deletions
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 16 (`nodejs:16` & `openwhisk/action-nodejs-v16`)
3030
- Node.js 18 (`nodejs:18` & `openwhisk/action-nodejs-v18`)
31+
- Node.js 20 (`nodejs:20` & `openwhisk/action-nodejs-v20`)
3132

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

@@ -49,6 +50,7 @@ All the runtime images are published by the project to Docker Hub @ [https://hub
4950

5051
- [https://hub.docker.com/r/openwhisk/action-nodejs-v16](https://hub.docker.com/r/openwhisk/action-nodejs-v16)
5152
- [https://hub.docker.com/r/openwhisk/action-nodejs-v18](https://hub.docker.com/r/openwhisk/action-nodejs-v18)
53+
- [https://hub.docker.com/r/openwhisk/action-nodejs-v20](https://hub.docker.com/r/openwhisk/action-nodejs-v20)
5254

5355
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.
5456

@@ -97,6 +99,7 @@ This will return the following runtime images with the following names: `action-
9799
```
98100
./gradlew tests:dat:docker:nodejs16docker:distDocker
99101
./gradlew tests:dat:docker:nodejs18docker:distDocker
102+
./gradlew tests:dat:docker:nodejs20docker:distDocker
100103
```
101104

102105
- Run the project tests.

core/nodejs20Action/.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/nodejs20Action/CHANGELOG.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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 20 OpenWhisk Runtime Container
21+
22+
# Next Release
23+
- Initial release with support for Node.js v1.18
24+
25+
Node.js version = [20.3.0](https://nodejs.org/en/blog/release/v20.3.0/)
26+
OpenWhisk version = [OpenWhisk v3.21.7](https://www.npmjs.com/package/openwhisk)

core/nodejs20Action/Dockerfile

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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:20-bullseye
19+
20+
# Initial update and some basics.
21+
#
22+
RUN apt-get update && apt-get install -y \
23+
imagemagick \
24+
graphicsmagick \
25+
zip \
26+
unzip \
27+
&& rm -rf /var/lib/apt/lists/*
28+
29+
# Add sources and copy the package.json to root container,
30+
# so npm packages from user functions take precedence.
31+
#
32+
WORKDIR /nodejsAction
33+
ADD . /nodejsAction/
34+
COPY package.json /
35+
36+
# Customize runtime with additional packages.
37+
# Install package globally so user packages can override.
38+
#
39+
RUN cd / && npm install --no-package-lock --production \
40+
&& npm cache clean --force
41+
42+
EXPOSE 8080
43+
44+
CMD node --expose-gc app.js

core/nodejs20Action/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-v20'
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,8 +20,10 @@ include 'tests'
2020
include 'core:nodejsActionBase'
2121
include 'core:nodejs16Action'
2222
include 'core:nodejs18Action'
23+
include 'core:nodejs20Action'
2324
include 'tests:dat:docker:nodejs16docker'
2425
include 'tests:dat:docker:nodejs18docker'
26+
include 'tests:dat:docker:nodejs20docker'
2527

2628
rootProject.name = 'runtime-nodejs'
2729

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-v20
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 = 'nodejs20docker'
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)