Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial support for Nodejs 8 #2080

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ scala:
services:
- docker

env:
global:
- TERM=dumb

notifications:
email: false
slack:
Expand Down
2 changes: 2 additions & 0 deletions ansible/group_vars/all
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ runtimesManifest:
- kind: "nodejs:6"
image: "nodejs6action"
default: true
- kind: "nodejs:8"
image: "nodejs8action"
python:
- kind: "python"
image: "python2action"
Expand Down
1 change: 1 addition & 0 deletions ansible/roles/invoker/tasks/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- '{{ docker_image_prefix }}/invoker'
- '{{ docker_image_prefix }}/dockerskeleton'
- '{{ docker_image_prefix }}/nodejs6action'
- '{{ docker_image_prefix }}/nodejs8action'
- '{{ docker_image_prefix }}/python2action'
- '{{ docker_image_prefix }}/python3action'
- '{{ docker_image_prefix }}/swift3action'
Expand Down
95 changes: 95 additions & 0 deletions core/nodejs8Action/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
FROM buildpack-deps:xenial-scm

ENV DEBIAN_FRONTEND noninteractive

# Initial update and some basics.
RUN apt-get update && apt-get install -y imagemagick && apt-get install -y unzip

ADD ./nodejsAction /nodejsAction

# based on https://github.com/nodejs/docker-node


RUN groupadd --gid 1000 node \
&& useradd --uid 1000 --gid node --shell /bin/bash --create-home node


ENV NPM_CONFIG_LOGLEVEL info
ENV NODE_VERSION 8.0.0-test20170327db9805885fb817c5b36e5b2bb53b82c0765e438f

RUN curl -SLO "https://nodejs.org/download/test/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.gz" \
&& tar -xzf "node-v$NODE_VERSION-linux-x64.tar.gz" -C /usr/local --strip-components=1 \
&& rm "node-v$NODE_VERSION-linux-x64.tar.gz" \
&& ln -s /usr/local/bin/node /usr/local/bin/nodejs

ENV YARN_VERSION 0.21.3

RUN set -ex \
&& curl -fSL -o yarn.js "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-$YARN_VERSION.js" \
&& mv yarn.js /usr/local/bin/yarn \
&& chmod +x /usr/local/bin/yarn

WORKDIR /nodejsAction

# Install app dependencies
RUN rm -rf .project .settings build.xml Dockerfile README node_modules logs
RUN npm install .

RUN npm install \
apn@2.1.2 \
async@2.1.4 \
body-parser@1.15.2 \
btoa@1.1.2 \
cheerio@0.22.0 \
cloudant@1.6.2 \
commander@2.9.0 \
consul@0.27.0 \
cookie-parser@1.4.3 \
cradle@0.7.1 \
errorhandler@1.5.0 \
express@4.14.0 \
express-session@1.14.2 \
glob@7.1.1 \
gm@1.23.0 \
lodash@4.17.2 \
log4js@0.6.38 \
iconv-lite@0.4.15 \
marked@0.3.6 \
merge@1.2.0 \
moment@2.17.0 \
mongodb@2.2.11 \
mustache@2.3.0 \
nano@6.2.0 \
node-uuid@1.4.7 \
nodemailer@2.6.4 \
oauth2-server@2.4.1 \
openwhisk@3.3.2 \
pkgcloud@1.4.0 \
process@0.11.9 \
pug@">=2.0.0-beta6 <2.0.1" \
redis@2.6.3 \
request@2.79.0 \
request-promise@4.1.1 \
rimraf@2.5.4 \
semver@5.3.0 \
sendgrid@4.7.1 \
serve-favicon@2.3.2 \
socket.io@1.6.0 \
socket.io-client@1.6.0 \
superagent@3.0.0 \
swagger-tools@0.10.1 \
tmp@0.0.31 \
twilio@2.11.1 \
underscore@1.8.3 \
uuid@3.0.0 \
validator@6.1.0 \
watson-developer-cloud@2.14.3 \
when@3.7.7 \
winston@2.3.0 \
ws@1.1.1 \
xml2js@0.4.17 \
xmlhttprequest@1.8.0 \
yauzl@2.7.0

# See app.js
CMD node app.js
21 changes: 21 additions & 0 deletions core/nodejs8Action/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apply plugin: 'eclipse'
eclipse {
project {
natures 'org.eclipse.wst.jsdt.core.jsNature'
buildCommand 'org.eclipse.wst.jsdt.core.javascriptValidator'
}
}

ext.dockerImageName = 'nodejs8action'
apply from: '../../gradle/docker.gradle'
distDocker.dependsOn 'copyProxy'
distDocker.finalizedBy('rmProxy')

task copyProxy(type: Copy) {
from '../nodejsActionBase'
Copy link
Contributor

@markusthoemmes markusthoemmes Mar 30, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Want to use the same method as outlined for the python runners?

See : https://github.com/openwhisk/openwhisk/blob/master/core/python2Action/build.gradle

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good feedback, I will change it.

I took the example from swift3 runner
https://github.com/openwhisk/openwhisk/blob/master/core/swift3Action/build.gradle

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@markusthoemmes need some help here:
made changes to

ext.dockerImageName = 'nodejs8action'
apply from: '../../gradle/docker.gradle'
distDocker.dependsOn 'copyFiles'
distDocker.finalizedBy 'rmFiles'

def runners = files(
    new File(project(':core:nodejsActionBase').projectDir)
)

task copyFiles(type: Copy) {
    from runners
    into '.'
}

task rmFiles(type: Delete) {
    delete runners.collect { it.getName() }
}

But I get errors running distDocker

* What went wrong:
A problem occurred evaluating project ':core:nodejs8Action'.
> Could not find matching constructor for: java.io.File(java.io.File)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nevermind figured it out

project(':core:nodejsActionBase').projectDir

into 'nodejsAction'
}

task rmProxy(type: Delete) {
delete 'nodejsAction'
}
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ include 'core:controller'
include 'core:invoker'
include 'core:nodejsActionBase'
include 'core:nodejs6Action'
include 'core:nodejs8Action'
include 'core:actionProxy'
include 'core:pythonAction'
include 'core:python2Action'
Expand Down
5 changes: 5 additions & 0 deletions tools/build/redo
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,11 @@ Components = [
yaml = False,
gradle = 'core:nodejs6Action'),

makeComponent('nodejs8action',
'build node.js v8 action container',
yaml = False,
gradle = 'core:nodejs8Action'),

makeComponent('actionproxy',
'build action proxy container',
yaml = False,
Expand Down