Skip to content

Commit

Permalink
Merge pull request #11 from berndtj/add-lock
Browse files Browse the repository at this point in the history
add /tmp/.lock for openfaas readiness
  • Loading branch information
berndtj committed Jun 14, 2018
2 parents 604c626 + 5852fec commit 39f6270
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
3 changes: 3 additions & 0 deletions Dockerfile
Expand Up @@ -23,4 +23,7 @@ WORKDIR ${WORKDIR}
COPY function-server /function-server/
RUN cd /function-server; npm install --production

# OpenFaaS readiness check depends on this file
RUN touch /tmp/.lock

CMD node /function-server/server.js $(cat /tmp/handler)
8 changes: 4 additions & 4 deletions README.md
@@ -1,7 +1,7 @@
# nodejs-base-image
JavaScript (Node.js) support for Dispatch

Latest image [on Docker Hub](https://hub.docker.com/r/dispatchframework/nodejs-base/): `dispatchframework/nodejs-base:0.0.8`
Latest image [on Docker Hub](https://hub.docker.com/r/dispatchframework/nodejs-base/)

## Usage

Expand All @@ -11,7 +11,7 @@ You need a recent version of Dispatch [installed in your Kubernetes cluster, Dis

To add the base-image to Dispatch:
```bash
$ dispatch create base-image nodejs-base dispatchframework/nodejs-base:0.0.8
$ dispatch create base-image nodejs-base dispatchframework/nodejs-base:<tag>
```

Make sure the base-image status is `READY` (it normally goes from `INITIALIZED` to `READY`):
Expand Down Expand Up @@ -47,7 +47,7 @@ $ dispatch get image nodejs-mylibs

Using the Node.js base-image, you can create Dispatch functions from Node.js (javascript) source files. The file can require any libraries from the image (see above).

The only requirement is: **`module.exports`** must be set to a function that accepts 2 arguments (`context` and `payload`), for example:
The only requirement is: **`module.exports`** must be set to a function that accepts 2 arguments (`context` and `payload`), for example:
```bash
$ cat ./demo.js
```
Expand Down Expand Up @@ -132,4 +132,4 @@ module.exports = function(context, payload) {

### Note

Since **`TypeError`** is considered an `InputError`, functions should not throw it unless explicitly thrown due to an input validation error. Functions should catch and handle **`TypeError`** accordingly if it should not be classified as an `InputError`.
Since **`TypeError`** is considered an `InputError`, functions should not throw it unless explicitly thrown due to an input validation error. Functions should catch and handle **`TypeError`** accordingly if it should not be classified as an `InputError`.
8 changes: 7 additions & 1 deletion build.sh
@@ -1,6 +1,12 @@
#!/bin/sh
set -e -x

: ${DOCKER_REGISTRY:="dispatchframework"}

cd $(dirname $0)

docker build -t dispatchframework/nodejs-base:0.0.8 .
IMAGE=${DOCKER_REGISTRY}/nodejs-base:$(cat version.txt)
docker build -t ${IMAGE} .
if [ -n "$PUSH" ]; then
docker push ${IMAGE}
fi
1 change: 1 addition & 0 deletions version.txt
@@ -0,0 +1 @@
0.0.9

0 comments on commit 39f6270

Please sign in to comment.