mrutkows commented on a change in pull request #190: URL: https://github.com/apache/openwhisk-runtime-nodejs/pull/190#discussion_r593371641
########## File path: README.md ########## @@ -34,7 +34,312 @@ This README documents the build, customisation and testing of these runtime imag **Do you want to learn more about using Node.js actions to build serverless applications?** Please see the main project documentation [here](https://github.com/apache/openwhisk/blob/master/docs/actions-nodejs.md) for that information. -## Usage +## Build Runtimes + +### You have 2 options to build the NodeJS runtime: +- Building locally +- Using OpenWhisk Actions. +### This README walks you through how to do both + +# Building NodeJS Runtime Locally + +### Pre-requisites +- [Docker](https://www.docker.com/) +- [curl](https://curl.se/), [wget](https://www.gnu.org/software/wget/), or [Postman](https://www.postman.com/) + + +0. Choose/create a folder of your liking and make sure docker daemon is running + +1. Clone this repo: +``` +git clone https://github.com/apache/openwhisk-runtime-nodejs +cd openwhisk-runtime-nodejs +``` + +1.1 Choose a NodeJS version. All build files reside inside `core/nodejsActionBase`. If you take a look into `core/nodejsActionBase/Dockerfile` you’ll see a line that looks like: +``` +FROM node:lts-stretch +``` +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: +``` +FROM node:14.16.0-stretch +``` + +Or in the command line you can simply type: +``` +cp core/nodejs14Action/Dockerfile core/nodejsActionBase/ +``` + +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. + +**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): +``` +git reset --hard origin/master +``` + +2. Build docker Review comment: Subsection "Build the docker image" -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
