From 0b247732408f877aabca3adf77381fc37776f43a Mon Sep 17 00:00:00 2001
From: Jacek Kowalski <Jacek@jacekk.info>
Date: Tue, 28 Jun 2016 19:35:05 +0000
Subject: [PATCH] Enable JVM options customization

---
 run.sh    |    6 +++++-
 README.md |   12 ++++++++++++
 2 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/README.md b/README.md
index d105f7d..afa9cca 100644
--- a/README.md
+++ b/README.md
@@ -56,3 +56,15 @@
 You can configure the instance by editing files 
 in directory /opt/gitblit-data inside the container
 (or appropriate host dir if local storage is used).
+
+By default the JVM is started with options `-server -Xmx1024m`.
+You can override this default using `JAVA_OPTS` environment
+variable:
+
+```bash
+docker run -d --name=gitblit \
+	-p 8080:8080 -p 8443:8443 \
+	-p 9418:9418 -p 29418:29418 \
+	-e "JAVA_OPTS=-Xmx512m" \
+	jacekkow/gitblit
+```
diff --git a/run.sh b/run.sh
index b922fd4..2467c21 100755
--- a/run.sh
+++ b/run.sh
@@ -4,6 +4,10 @@
 	cp -Rf /opt/gitblit-data-initial/* /opt/gitblit-data/
 fi
 
+if [ -z "$JAVA_OPTS" ]; then
+	JAVA_OPTS="-server -Xmx1024m"
+fi
+
 chown -Rf gitblit:gitblit /opt/gitblit-data
 
-exec sudo -u gitblit java -server -Xmx1024M -Djava.awt.headless=true -jar /opt/gitblit/gitblit.jar --baseFolder /opt/gitblit-data
+exec sudo -u gitblit java $JAVA_OPTS -Djava.awt.headless=true -jar /opt/gitblit/gitblit.jar --baseFolder /opt/gitblit-data

--
Gitblit v1.9.1