Adding CoffeeScript base example

Adding CoffeeScript base
This commit is contained in:
aafrey 2017-04-10 17:17:35 -04:00 committed by Alex Ellis
parent de359881e7
commit c7db0faab4
5 changed files with 48 additions and 0 deletions

View File

@ -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 |

View 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"]

View File

@ -0,0 +1,5 @@
#!/bin/sh
echo "Building functions/base:coffeescript-1.12-alpine"
docker build -t functions/base:coffeescript-1.12-alpine .

View 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

View 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"
}
}