From ae85157b945e8ec6419599ce5a6500d60f2e8b45 Mon Sep 17 00:00:00 2001
From: Luis Fernando Gomes <dev@luiscoms.com.br>
Date: Thu, 15 Sep 2016 19:03:04 -0300
Subject: [PATCH] Add $APP_TARGET and $MVN_ARGS env var

---
 README.md        | 10 ++++++++++
 s2i/bin/assemble |  5 +++--
 s2i/bin/run      |  4 +++-
 3 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md
index b61da3a..441c55f 100644
--- a/README.md
+++ b/README.md
@@ -55,6 +55,16 @@ $ curl 127.0.0.1:8080
     application GIT repository. In case your application is located in a
     sub-folder, you can set this variable to a *./myapplication*.
 
+*  **APP_TARGET** (default: '')
+
+    This variable specifies a relative location to your application binary inside the
+    container.
+
+*  **MVN_ARGS** (default: '')
+
+    This variable specifies the arguments for Maven inside the container.
+
+
 ## Contributing
 
 In order to test your changes to this STI image or to the STI scripts, you can use the `test/run` script. Before that, you have to build the 'candidate' image:
diff --git a/s2i/bin/assemble b/s2i/bin/assemble
index ec56423..8021fb5 100755
--- a/s2i/bin/assemble
+++ b/s2i/bin/assemble
@@ -6,10 +6,11 @@ echo "---> Installing application source"
 cp -Rf /tmp/src/. ./
 
 echo "---> Building Spring Boot application from source"
+echo "--> # MVN_ARGS = $MVN_ARGS"
 if [ -f "mvnw" ]; then
-  ./mvnw clean install
+  ./mvnw clean install $MVN_ARGS
 else
-  mvn clean install
+  mvn clean install $MVN_ARGS
 fi
 
 # Fix source directory permissions
diff --git a/s2i/bin/run b/s2i/bin/run
index a01a76a..2e3e3ef 100755
--- a/s2i/bin/run
+++ b/s2i/bin/run
@@ -3,4 +3,6 @@
 set -e
 
 echo "---> Starting Spring Boot application"
-java -jar `find target -name *.jar`
+echo "--> # APP_TARGET = $APP_TARGET"
+echo "--> # JAVA_OPTS = $JAVA_OPTS"
+java $JAVA_OPTS -jar `find $APP_TARGET -name *.jar`
-- 
GitLab