mirror of
https://github.com/openfaas/faas.git
synced 2025-06-18 12:06:37 +00:00
Moving out the cat service as an example.
This commit is contained in:
@ -1,9 +0,0 @@
|
||||
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"]
|
9
sample-functions/catservice/Dockerfile
Normal file
9
sample-functions/catservice/Dockerfile
Normal file
@ -0,0 +1,9 @@
|
||||
FROM alpine:latest
|
||||
ENTRYPOINT []
|
||||
|
||||
COPY ./fwatchdog /usr/bin/fwatchdog
|
||||
ENV fprocess "cat"
|
||||
|
||||
|
||||
EXPOSE 8080
|
||||
CMD ["/usr/bin/fwatchdog"]
|
17
sample-functions/catservice/README.md
Normal file
17
sample-functions/catservice/README.md
Normal file
@ -0,0 +1,17 @@
|
||||
* Build the watchdog app which outputs fwatchdog
|
||||
|
||||
* Copy fwatchdog to the directory of each function you want to build.
|
||||
|
||||
* Create a service for each function:
|
||||
|
||||
```
|
||||
# docker build -t catservice .
|
||||
# docker service rm catservice ; docker service create --network=functions --name catservice catservice
|
||||
```
|
||||
|
||||
* Consume it like this:
|
||||
|
||||
```
|
||||
# curl -X POST -d @$HOME/.ssh/id_rsa.pub -H "X-Function: catservice" localhost:8080/
|
||||
ssh-rsa AAAAB3NzaC1yc2....
|
||||
```
|
@ -1,3 +0,0 @@
|
||||
'use strict'
|
||||
let os = require('os');
|
||||
console.log(os.platform(), os.arch(), os.cpus(), os.uptime(), os.userInfo());
|
@ -1,12 +0,0 @@
|
||||
{
|
||||
"name": "sample-functions",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC"
|
||||
}
|
Reference in New Issue
Block a user