From bfe4c148a5986fde55c226fad07f06173b81fa85 Mon Sep 17 00:00:00 2001 From: Tim Hughes Date: Thu, 29 Oct 2015 21:58:29 +0000 Subject: [PATCH] add in make target --- Makefile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Makefile b/Makefile index 232c7a6..3ac7fef 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,9 @@ 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} . @@ -8,3 +12,8 @@ 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" + +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 +