Skip to content

The Unified and Autonomous Development Platform

Fix issue #738 - Set JVM parameters for docker container

Robin Shend3e0e172ac04
diff --git a/server-product/docker/entrypoint.sh b/server-product/docker/entrypoint.sh
index 1d8034fcee..a6159eee81 100755
--- a/server-product/docker/entrypoint.sh
+++ b/server-product/docker/entrypoint.sh
@@ -11,14 +11,19 @@ _sigterm() {
trap _sigterm SIGTERM
trap _sigterm SIGINT
+JVM_OPTIONS=--XX:MaxRAMPercentage=50.0
+if [[ $JAVA_TOOL_OPTIONS == *"--XX:MaxRAMPercentage"* ]] || [[ $JAVA_TOOL_OPTIONS == *"-Xmx"* ]]; then
+ unset JVM_OPTIONS
+fi
+
cd /app/bin
-java -cp "../boot/*" -XX:MaxRAMPercentage=50.0 io.onedev.commons.bootstrap.Bootstrap upgrade /opt/onedev &
+java -cp "../boot/*" ${JVM_OPTIONS} io.onedev.commons.bootstrap.Bootstrap upgrade /opt/onedev &
child=$!
wait "$child"
touch /opt/onedev/IN_DOCKER
cd /opt/onedev/bin
-java -cp "../boot/*" -XX:MaxRAMPercentage=50.0 io.onedev.commons.bootstrap.Bootstrap &
+java -cp "../boot/*" ${JVM_OPTIONS} io.onedev.commons.bootstrap.Bootstrap &
child=$!
wait "$child"