You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
If you build a custom version of the images, pushing those an external Docker Hub repository will allow you to use those on the Apache OpenWhisk deployment.
89
+
90
+
### Runtimes Manifest
91
+
92
+
Available runtimes in Apache OpenWhisk are defined using the runtimes manifest in this file: [runtimes.json](https://github.com/apache/openwhisk/blob/master/ansible/files/runtimes.json#L16-L72)
93
+
94
+
Modify the manifest and re-deploy the platform to pick up local images changes.
95
+
96
+
## Development
97
+
98
+
Dockerfiles for runtime images are defined in the `core` directory. Each runtime version folder has a custom `Dockerfile` and `package.json`. If you need to add extra dependencies to a runtime version - modify these files.
99
+
100
+
The `core/nodejsActionBase` folder contains the Node.js app server used to implement the [action interface](https://github.com/apache/openwhisk/blob/master/docs/actions-new.md#action-interface), used by the platform to inject action code into the runtime and fire invocation requests. This common code is used in all runtime versions.
101
+
102
+
### Build <aname="build_gradle"></a>
103
+
104
+
- Run the `distDocker` command to generate local Docker images for the different runtime versions. (Make sure docker daemon is running)
105
+
106
+
```
107
+
./gradlew core:nodejs10Action:distDocker
108
+
./gradlew core:nodejs12Action:distDocker
109
+
./gradlew core:nodejs14Action:distDocker
110
+
```
111
+
112
+
This will return the following runtime images with the following names: `action-nodejs-v10`, `action-nodejs-v12` and `action-nodejs-v14`.
113
+
114
+
### Testing
115
+
116
+
- Install project dependencies from the top-level Apache OpenWhisk [project](https://github.com/apache/openwhisk), which ensures correct versions of dependent libraries are available in the Maven cache.
117
+
118
+
```
119
+
./gradlew install
120
+
```
121
+
122
+
*This command **MUST BE** run from the directory containing the main Apache OpenWhisk [repository](https://github.com/apache/openwhisk), not this repository's directory.*
123
+
124
+
- Build the local Docker images for the runtime versions (see the instructions above).
125
+
- Build the custom Docker images used in local testing.
This will use the latest NodeJS version. But we want to be more specific. Now if you look into each of the Dockerfile’s of `core/nodejs14Action`, `core/nodejs12Action`, `core/nodejs10Action`, you’ll notice different nodeJS versions. Let’s go ahead with the 14 version. All you have to do is substitute the line above from `core/nodejsActionBase/Dockerfile` with the equivalent line from `core/nodejs14Action/Dockerfile` that looks like:
64
-
```
65
-
FROM node:14.16.0-stretch
66
-
```
160
+
This will use the latest NodeJS version. But we want to be more specific. Now if you look into each of the Dockerfile’s of `core/nodejs14Action`, `core/nodejs12Action`, `core/nodejs10Action`, you’ll notice different nodeJS versions. Let’s go ahead with the 14 version. We'll be creating a `build` folder that will contain all the necessary files for us to build our NodeJS container. All you have to do is copy paste the commands below. This will copy the NodeJS application as well as our target Dockerfile with the NodeJS version 14.
If you follow the instructions at end of this tutorial [here](#build_dradle) that uses Gradle, you'll notice that Gradle takes care of this copying for us internally. Here since we just want to use docker and not worry about anything else we copy manually.
168
+
If you follow the instructions at beginning of this tutorial [here](#build_gradle) that uses Gradle, you'll notice that Gradle takes care of this copying for us internally. Here since we just want to use docker and not worry about anything else we make create our own little build folder.
74
169
75
170
**NOTE**: If you think that you messed up some file you can restore all files to its original state by typing the following. Then you can repeat the above command (careful with this command as it will remove all modifications you made to any file locally):
2.1. Check docker `IMAGE ID` (1st column) for repository `nodejs-action-v14` (assuming you built with the first option above)
180
+
2.1. Check docker `IMAGE ID` (1st column) for repository `nodejs-action-v14`
86
181
```
87
182
docker images
88
183
```
@@ -100,7 +195,7 @@ Or run the container in the background (Add `-d` (detached) to the command above
100
195
```
101
196
docker run -d -p 127.0.0.1:80:8080/tcp --name=bloom_whisker --rm -it nodejs-action-v14:1.0-SNAPSHOT
102
197
```
103
-
198
+
**NOTE**: The instructions above that [uses gradle](#using_gradle) will also create a docker image. You can also use that image to start your NodeJS container locally and issue the below commands against localhost and things should still work <br/><br/>
#### At this point you can edit js-fib-run.json an try other `fib_n` values. All you have to do is save `js-fib-run.json` and trigger the function again. Notice that here we're just modifying the parameters of our function; therefore, there's no need to re-run/re-initialize our container that contains our NodeJS runtime.
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.
If you build a custom version of the images, pushing those an external Docker Hub repository will allow you to use those on the Apache OpenWhisk deployment.
379
-
380
-
### Runtimes Manifest
381
-
382
-
Available runtimes in Apache OpenWhisk are defined using the runtimes manifest in this file: [runtimes.json](https://github.com/apache/openwhisk/blob/master/ansible/files/runtimes.json#L16-L72)
383
-
384
-
Modify the manifest and re-deploy the platform to pick up local images changes.
385
-
386
-
## Development
387
-
388
-
Dockerfiles for runtime images are defined in the `core` directory. Each runtime version folder has a custom `Dockerfile` and `package.json`. If you need to add extra dependencies to a runtime version - modify these files.
389
-
390
-
The `core/nodejsActionBase` folder contains the Node.js app server used to implement the [action interface](https://github.com/apache/openwhisk/blob/master/docs/actions-new.md#action-interface), used by the platform to inject action code into the runtime and fire invocation requests. This common code is used in all runtime versions.
391
-
392
-
### Build <aname="build_dradle"></a>
393
-
394
-
- Run the `distDocker` command to generate local Docker images for the different runtime versions. (Make sure docker daemon is running)
395
-
396
-
```
397
-
./gradlew core:nodejs10Action:distDocker
398
-
./gradlew core:nodejs12Action:distDocker
399
-
./gradlew core:nodejs14Action:distDocker
400
-
```
401
-
402
-
This will return the following runtime images with the following names: `action-nodejs-v10`, `action-nodejs-v12` and `action-nodejs-v14`.
403
-
404
-
### Testing
405
-
406
-
- Install project dependencies from the top-level Apache OpenWhisk [project](https://github.com/apache/openwhisk), which ensures correct versions of dependent libraries are available in the Maven cache.
407
-
408
-
```
409
-
./gradlew install
410
-
```
411
-
412
-
*This command **MUST BE** run from the directory containing the main Apache OpenWhisk [repository](https://github.com/apache/openwhisk), not this repository's directory.*
413
-
414
-
- Build the local Docker images for the runtime versions (see the instructions above).
415
-
- Build the custom Docker images used in local testing.
0 commit comments