mirror of
https://github.com/openfaas/faas.git
synced 2025-06-08 16:26:47 +00:00
Adding CoffeeScript base example
Adding CoffeeScript base
This commit is contained in:
parent
de359881e7
commit
c7db0faab4
@ -7,6 +7,7 @@ Each one will read the request from the watchdog then print it back resulting in
|
||||
| Language | Docker image | Notes |
|
||||
|------------------------|-----------------------------------------|----------------------------------------|
|
||||
| Node.js | functions/base:node-6.9.1-alpine | Node.js built on Alpine Linux |
|
||||
| Coffeescript | functions/base:node-6.9.1-alpine | Coffeescript/Nodejs built on Alpine Linux |
|
||||
| Golang | functions/base:golang-1.7.5-alpine | Golang compiled on Alpine Linux |
|
||||
| Python | functions/base:python-2.7-alpine | Python 2.7 built on Alpine Linux |
|
||||
| Java | functions/base:openjdk-8u121-jdk-alpine | OpenJDK built on Alpine Linux |
|
||||
|
19
sample-functions/BaseFunctions/coffee/Dockerfile
Normal file
19
sample-functions/BaseFunctions/coffee/Dockerfile
Normal file
@ -0,0 +1,19 @@
|
||||
FROM node:6.9.1-alpine
|
||||
|
||||
ADD https://github.com/alexellis/faas/releases/download/0.5.1-alpha/fwatchdog /usr/bin
|
||||
RUN chmod +x /usr/bin/fwatchdog
|
||||
|
||||
WORKDIR /root/
|
||||
|
||||
COPY package.json .
|
||||
|
||||
RUN npm install -g coffee-script && \
|
||||
npm i
|
||||
|
||||
COPY handler.coffee .
|
||||
|
||||
ENV fprocess="coffee handler.coffee"
|
||||
|
||||
HEALTHCHECK --interval=1s CMD [ -e /tmp/.lock ] || exit 1
|
||||
|
||||
CMD ["fwatchdog"]
|
5
sample-functions/BaseFunctions/coffee/build.sh
Normal file
5
sample-functions/BaseFunctions/coffee/build.sh
Normal file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "Building functions/base:coffeescript-1.12-alpine"
|
||||
docker build -t functions/base:coffeescript-1.12-alpine .
|
||||
|
7
sample-functions/BaseFunctions/coffee/handler.coffee
Normal file
7
sample-functions/BaseFunctions/coffee/handler.coffee
Normal file
@ -0,0 +1,7 @@
|
||||
getStdin = require 'get-stdin'
|
||||
|
||||
handler = (req) -> console.log req
|
||||
|
||||
getStdin()
|
||||
.then (val) -> handler val
|
||||
.catch (e) -> console.error e.stack
|
16
sample-functions/BaseFunctions/coffee/package.json
Normal file
16
sample-functions/BaseFunctions/coffee/package.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "NodejsBase",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "faas_index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"coffeescript": "^1.12.4",
|
||||
"get-stdin": "^5.0.1"
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user