From b7081f393417d9cb874de0c8061fb3e4c811e761 Mon Sep 17 00:00:00 2001 From: almir Date: Tue, 3 Nov 2015 09:07:38 +0100 Subject: [PATCH 1/3] - adjust Makefile syntax --- Makefile | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 3ac7fef..b8c2342 100644 --- a/Makefile +++ b/Makefile @@ -1,19 +1,18 @@ -DOCKER_IMAGE_NAME=adnanh/webhook -CONTAINER_NAME=webhook +DOCKER_IMAGE_NAME = adnanh/webhook +CONTAINER_NAME = webhook COMMIT := $(shell git rev-parse HEAD) SHORTCOMMIT := $(shell git rev-parse HEAD|cut -c-7) TEMPDIR := $(shell mktemp -d) docker-build: Dockerfile - docker build --force-rm=true --tag=${DOCKER_IMAGE_NAME} . + docker build --force-rm=true --tag=$(DOCKER_IMAGE_NAME) . docker-run: @echo "Here's an example command on how to run a webhook container:" - @echo "docker run -d -p 9000:9000 -v /etc/webhook:/etc/webhook --name=${CONTAINER_NAME} \\" - @echo " ${DOCKER_IMAGE_NAME} -verbose -hooks=/etc/webhook/hooks.json -hotreload" + @echo "docker run -d -p 9000:9000 -v /etc/webhook:/etc/webhook --name=$(CONTAINER_NAME) \\" + @echo " $(DOCKER_IMAGE_NAME) -verbose -hooks=/etc/webhook/hooks.json -hotreload" build_rpm: git archive --format=tar.gz --prefix webhook-$(COMMIT)/ --output $(TEMPDIR)/webhook-$(SHORTCOMMIT).tar.gz $(COMMIT) rpmbuild -ta --define "_commit $(COMMIT)" $(TEMPDIR)/webhook-$(SHORTCOMMIT).tar.gz - From 5f041cb9ae2a5ba71277a6ea97d0bfc2188ed2ac Mon Sep 17 00:00:00 2001 From: almir Date: Tue, 3 Nov 2015 09:25:53 +0100 Subject: [PATCH 2/3] - add docker section to readme --- README.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/README.md b/README.md index 991371e..4a37b72 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,36 @@ However, hook defined like that could pose a security threat to your system, bec # Examples Check out [Hook examples page](https://github.com/adnanh/webhook/wiki/Hook-Examples) for more complex examples of hooks. +# Running webhook in Docker +The simplest usage of [adnanh/webhook](https://hub.docker.com/r/adnanh/webhook/) image is for one to host the hooks JSON file on their machine and mount the directory in which those are kept as a volume to the Docker container: +```shell +docker run -d -p 9000:9000 -v /dir/to/hooks/on/host:/etc/webhook --name=webhook \ + adnanh/webhook -verbose -hooks=/etc/webhook/hooks.json -hotreload +``` + +Another method of using this Docker image is to create a simple `Dockerfile`: +```docker +FROM adnanh/webhook +COPY hooks.json.example /etc/webhook/hooks.json +``` + +This `Dockerfile` and `hooks.json` files should be placed inside the same directory. After that run `docker build -t my-webhook-image .` and then start your container: +```shell +docker run -d -p 9000:9000 --name=webhook my-webhook-image -verbose -hooks=/etc/webhook/hooks.json -hotreload +``` + +Additionally, one can specify the parameters to be passed to [webhook](https://github.com/adnanh/webhook/) in `Dockerfile` simply by adding one more line to the previous example: +```docker +FROM adnanh/webhook +COPY hooks.json.example /etc/webhook/hooks.json +CMD ["-verbose", "-hooks=/etc/webhook/hooks.json", "-hotreload"] +``` + +Now, after building your Docker image with `docker build -t my-webhook-image .`, you can start your container by running just: +```shell +docker run -d -p 9000:9000 --name=webhook my-webhook-image +``` + # Contributing Any form of contribution is welcome and highly appreciated. From aff3a155d79a0d4a4c0cfecb741fc200be9c7053 Mon Sep 17 00:00:00 2001 From: almir Date: Tue, 3 Nov 2015 09:28:42 +0100 Subject: [PATCH 3/3] - fix hooks.json file name in readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4a37b72..a2bfa8c 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ FROM adnanh/webhook COPY hooks.json.example /etc/webhook/hooks.json ``` -This `Dockerfile` and `hooks.json` files should be placed inside the same directory. After that run `docker build -t my-webhook-image .` and then start your container: +This `Dockerfile` and `hooks.json.example` files should be placed inside the same directory. After that run `docker build -t my-webhook-image .` and then start your container: ```shell docker run -d -p 9000:9000 --name=webhook my-webhook-image -verbose -hooks=/etc/webhook/hooks.json -hotreload ```