From f1ccc2f347a8453d0b04a47cd8e4363193414cf4 Mon Sep 17 00:00:00 2001 From: kev Date: Thu, 5 Nov 2015 12:20:42 +0800 Subject: [PATCH] update webhook --- README.md | 1 + webhook/Dockerfile | 16 +++++++++--- webhook/README.md | 50 ++++++++++++++++++++++++++++++++++++++ webhook/docker-compose.yml | 7 ++++++ 4 files changed, 71 insertions(+), 3 deletions(-) create mode 100644 webhook/docker-compose.yml diff --git a/README.md b/README.md index 0d5cb4b..4920971 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,7 @@ dockerfiles - [x] tmail :beetle: - [x] tor - [x] urlwatch :beetle: +- [x] webhook - [x] webkit :beetle: - [x] youtube :beetle: - [x] youtube-dl diff --git a/webhook/Dockerfile b/webhook/Dockerfile index e133222..553aae5 100644 --- a/webhook/Dockerfile +++ b/webhook/Dockerfile @@ -2,7 +2,17 @@ # Dockerfile for webhook # -FROM scratch -COPY webhook / -ENTRYPOINT ["/webhook"] +FROM alpine +MAINTAINER kev + +RUN apk add -U bash + +COPY webhook /usr/local/bin + +WORKDIR /scripts +VOLUME /scripts + +EXPOSE 9000 + +ENTRYPOINT ["webhook"] CMD ["-help"] diff --git a/webhook/README.md b/webhook/README.md index c5ac601..9714098 100644 --- a/webhook/README.md +++ b/webhook/README.md @@ -5,4 +5,54 @@ webhook to easily create HTTP endpoints (hooks) on your server, which you can use to execute configured commands. +## Directory Tree + +``` +~/fig/webhook/ +├── docker-compose.yml +└── scripts/ + ├── hooks.json + └── test.sh* +``` + +docker-compose.yml + +``` +webhook: + image: vimagick/webhook + command: -hooks hooks.json -verbose + ports: + - "9000:9000" + volumes: + - "./scripts:/scripts" + +``` + +hooks.json + +``` +[ + { + "id": "test", + "execute-command": "/scripts/test.sh", + "command-working-directory": "/scripts" + } +] +``` + +test.sh + +``` +#!/bin/bash +echo 'hello world' +``` + +## Up and Running + +``` +$ docker-compose up -d +$ docker-compose logs +$ curl localhost:9000/hooks/test +``` + [1]: https://github.com/adnanh/webhook diff --git a/webhook/docker-compose.yml b/webhook/docker-compose.yml new file mode 100644 index 0000000..ce79011 --- /dev/null +++ b/webhook/docker-compose.yml @@ -0,0 +1,7 @@ +webhook: + image: vimagick/webhook + command: -hooks hooks.json -verbose + ports: + - "9000:9000" + volumes: + - "./scripts:/scripts"