jenkins: add JAVA_MEM var
In order to give us some flexibility in deploying jenkins,
let's add a JAVA_MEM variable that can set how many
gb to use.
In order to make this useful, we need to remove the memory
settings from the defaul JAVA_OPTS var in the dockerfile.
JAVA_OPTS is then re-exported before the entrypoint with the
memory settings concatenated.
Signed-off-by: Kelley Spoon <kelley.spoon@linaro.org>
Change-Id: I4ab3fc37eea33c8711a7cfb008dc834294ef8a63
diff --git a/jessie-amd64-jenkins-master/Dockerfile b/jessie-amd64-jenkins-master/Dockerfile
index dd1d366..b2978bc 100644
--- a/jessie-amd64-jenkins-master/Dockerfile
+++ b/jessie-amd64-jenkins-master/Dockerfile
@@ -2,8 +2,9 @@
ENV JENKINS_JAVA_PARAMETERS="-server -XX:+AlwaysPreTouch -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/var/log/jenkins/heapdump.log -XX:+UseG1GC -XX:+UseStringDeduplication -XX:+ParallelRefProcEnabled -XX:+ExplicitGCInvokesConcurrent -XX:+UnlockDiagnosticVMOptions -XX:G1SummarizeRSetStatsPeriod=1 -XX:MaxMetaspaceExpansion=64M -Djenkins.model.Jenkins.logStartupPerformance=true"
-ENV JAVA_OPTS="-Xms8g -Xmx8g $JENKINS_JAVA_PARAMETERS -Djava.awt.headless=true -Dhudson.slaves.WorkspaceList='_' -Dhudson.model.ParametersAction.keepUndefinedParameters=true -Dorg.jenkinsci.plugins.gitclient.Git.timeOut=30 -Dorg.eclipse.jetty.server.Request.maxFormContentSize=1000000"
+ENV JAVA_OPTS="$JENKINS_JAVA_PARAMETERS -Djava.awt.headless=true -Dhudson.slaves.WorkspaceList='_' -Dhudson.model.ParametersAction.keepUndefinedParameters=true -Dorg.jenkinsci.plugins.gitclient.Git.timeOut=30 -Dorg.eclipse.jetty.server.Request.maxFormContentSize=1000000"
ENV JENKINS_OPTS="--sessionTimeout=1440 --sessionEviction=86400"
+ENV JAVA_MEM=${JAVA_MEM:-8}
# Install jenkins job builder
# Create plugins directory, symlinked on host machine
@@ -39,7 +40,7 @@
# Install jenkins plugins
COPY plugins.txt .
RUN install-plugins.sh $(echo $(cat plugins.txt))
+RUN export JAVA_OPTS="-Xmx{$JAVA_MEM}g -Xms${JAVA_MEM}g $JAVA_OPTS"
# Forward ports to host
EXPOSE 2222
-