Merge pull request #214 from dhrapson/master

replace hard-coded /var/jenkins_home with $JENKINS_HOME
diff --git a/Jenkinsfile b/Jenkinsfile
new file mode 100644
index 0000000..f1f5202
--- /dev/null
+++ b/Jenkinsfile
@@ -0,0 +1,11 @@
+node('docker') {
+  stage 'Checkout'
+  checkout scm
+
+  stage 'Build'
+  docker.build('jenkins')
+
+  stage 'Test'
+  sh "git checkout https://github.com/sstephenson/bats.git"
+  sh "bats/bin/bats tests/tests.bats"
+}
diff --git a/README.md b/README.md
index 09f62ee..d732968 100644
--- a/README.md
+++ b/README.md
@@ -188,6 +188,18 @@
 
 As always - please ensure that you know how to drive docker - especially volume handling!
 
+# Building
+
+Build with the usual
+
+    docker build -t jenkins .
+
+Tests are written using [bats](https://github.com/sstephenson/bats) under the `tests` dir
+
+    bats tests
+
+Bats can be easily installed with `brew install bats` on OS X
+
 # Questions?
 
 Jump on irc.freenode.net and the #jenkins room. Ask!
diff --git a/jenkins.sh b/jenkins.sh
index 1894c04..2fa42cd 100755
--- a/jenkins.sh
+++ b/jenkins.sh
@@ -30,7 +30,7 @@
 
 # if `docker run` first argument start with `--` the user is passing jenkins launcher arguments
 if [[ $# -lt 1 ]] || [[ "$1" == "--"* ]]; then
-  exec java $JAVA_OPTS -jar /usr/share/jenkins/jenkins.war $JENKINS_OPTS "$@"
+  eval "exec java $JAVA_OPTS -jar /usr/share/jenkins/jenkins.war $JENKINS_OPTS \"\$@\""
 fi
 
 # As argument is not jenkins, assume user want to run his own process, for sample a `bash` shell to explore this image