mirror of
https://github.com/openfaas/faas.git
synced 2025-06-08 16:26:47 +00:00
Node info example
This commit is contained in:
parent
f566c65db4
commit
f9fd0a08b5
9
sample-functions/NodeInfo/Dockerfile
Normal file
9
sample-functions/NodeInfo/Dockerfile
Normal 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"]
|
7
sample-functions/NodeInfo/main.js
Normal file
7
sample-functions/NodeInfo/main.js
Normal 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());
|
||||
});
|
2
sample-functions/NodeInfo/oneshot.txt
Normal file
2
sample-functions/NodeInfo/oneshot.txt
Normal file
@ -0,0 +1,2 @@
|
||||
docker build -t nodeinfo . ; docker service rm NodeInfo ; docker service create --network=functions --name NodeInfo nodeinfo
|
||||
|
15
sample-functions/NodeInfo/package.json
Normal file
15
sample-functions/NodeInfo/package.json
Normal 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"
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user