Node info example

This commit is contained in:
Alex 2017-01-03 23:14:59 +00:00
parent f566c65db4
commit f9fd0a08b5
4 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,9 @@
FROM alpine:latest
RUN apk --update add nodejs
COPY ./fwatchdog /usr/bin/
COPY package.json .
COPY main.js .
RUN npm i
ENV fprocess="node main.js"
CMD ["fwatchdog"]

View File

@ -0,0 +1,7 @@
'use strict'
let os = require('os');
const getStdin = require('get-stdin');
getStdin().then(content => {
console.log(os.platform(), os.arch(), os.cpus(), os.uptime(), os.userInfo());
});

View File

@ -0,0 +1,2 @@
docker build -t nodeinfo . ; docker service rm NodeInfo ; docker service create --network=functions --name NodeInfo nodeinfo

View File

@ -0,0 +1,15 @@
{
"name": "sample-functions",
"version": "1.0.0",
"description": "",
"main": "main.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"get-stdin": "^5.0.1"
}
}