Combined build images for LDAP API, Server, Studio
diff --git a/docker/maven-build/Dockerfile b/docker/maven-build/Dockerfile
index 67a320e..4a95006 100644
--- a/docker/maven-build/Dockerfile
+++ b/docker/maven-build/Dockerfile
@@ -20,18 +20,38 @@
 ARG JDK_VERSION=8
 FROM maven:3-jdk-${JDK_VERSION}
 
-# Create home directory
-RUN mkdir -p /home/user/project && chmod 777 /home/user && chmod 777 /home/user/project
-WORKDIR /home/user/project
+# Base images maven:3-jdk-8 and maven:3-jdk-11 are based on Debian
+# Base image maven:3-jdk-12 is based on Oracle Linux
+RUN \
+if [ -e /etc/debian_version ]; then \
+    apt-get update && \
+    DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends xvfb krb5-config krb5-user dpkg rpm nsis && \
+    rm -rf /var/lib/apt/lists/* ; \
+elif [ -e /etc/oracle-release ]; then \
+    yum-config-manager --enable ol7_optional_latest && \
+    yum -y install xorg-x11-server-Xvfb xorg-x11-utils xorg-x11-server-utils krb5-libs krb5-workstation rpm dpkg nsis && \
+    yum -y clean all ; \
+fi
+
+# Create the temp dir for Xvfb
+RUN mkdir -p /tmp/.X11-unix && chmod 1777 /tmp/.X11-unix
 
 # Make /etc/passwd writeable to be able to inject username with dynamic uid/gid
 RUN chmod 666 /etc/passwd
+RUN chmod 666 /etc/group
+
+# Add krb5.conf with EXAMPLE.COM domain
+ADD files/krb5.conf /etc/
+
+# Create home directory
+RUN mkdir -p /home/hnelson/project && chmod 777 /home/hnelson && chmod 777 /home/hnelson/project
+WORKDIR /home/hnelson/project
 
 # Add and configure entrypoint script
-ADD entrypoint.sh /usr/local/bin
+ADD files/entrypoint.sh /usr/local/bin
 ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
 
 # Add build script and make it the default command
-ADD build.sh /usr/local/bin
+ADD files/build.sh /usr/local/bin
 CMD "/usr/local/bin/build.sh"
 
diff --git a/docker/maven-build/README.md b/docker/maven-build/README.md
index 701d107..490e2a3 100644
--- a/docker/maven-build/README.md
+++ b/docker/maven-build/README.md
@@ -18,46 +18,64 @@
 
 # About
 
-A docker image to run a regular Maven build within a docker container.
+A docker image for building Apache Directory projects. It's based on the official maven Docker images.
 
-It contains all requirements:
-* OpenJDK 8 or 11
+It contains all tools required for building and testing:
+* Java (OpenJDK 8, 11, or 12)
 * Maven 3.6
-
+* Xvfb (required by Studio UI tests)
+* Kerberos client and krb5 config with EXAMPLE.COM realm (required by Studio UI tests)
+* dpkg, rpm, nsis (for building ApacheDS installers)
 
 ## Build image
 
 See <https://hub.docker.com/_/maven> for available Maven base image tags.
 
-    JDK_VERSION=8
-    docker pull maven:3-jdk-${JDK_VERSION}
-    docker build -t apachedirectory/maven-build:jdk-${JDK_VERSION} --build-arg JDK_VERSION=${JDK_VERSION} .
-
+```
+JDK_VERSION=8
+docker pull maven:3-jdk-${JDK_VERSION}
+docker build -t apachedirectory/maven-build:jdk-${JDK_VERSION} --build-arg JDK_VERSION=${JDK_VERSION} .
+```
 
 ## Publish image
 
-    docker push apachedirectory/maven-build:jdk-${JDK_VERSION}
-
+```
+docker push apachedirectory/maven-build:jdk-${JDK_VERSION}
+```
 
 ## Usage
 
 Local:
 
-    docker run -it --rm \
-        -u $(id -u):$(id -g) \
-        -v ~/.m2:/home/user/.m2 \
-        -v $(pwd):/home/user/project \
-        apachedirectory/maven-build:jdk-8 bash
-
-    mvn clean install
-
+```
+docker run -it --rm \
+    -u $(id -u):$(id -g) \
+    -v ~/.m2:/home/hnelson/.m2 \
+    -v $(pwd):/home/hnelson/project \
+    apachedirectory/maven-build:jdk-8 mvn -V clean verify
+```
 
 On Jenkins:
 
-    docker run -i --rm \
-        -u $(id -u):$(id -g) \
-        -v ~/.m2:/home/user/.m2 \
-        -v $(pwd):/home/user/project \
-        apachedirectory/maven-build:jdk-8
+```
+docker run -i --rm \
+    -u $(id -u):$(id -g) \
+    -v ~/.m2:/home/hnelson/.m2 \
+    -v $(pwd):/home/hnelson/project \
+    apachedirectory/maven-build:jdk-8 mvn -V clean verify
+```
 
+In Jenkins Pipeline:
 
+```
+    agent {
+        docker {
+            label 'ubuntu'
+            image 'apachedirectory/maven-build:jdk-8'
+            args '-v $HOME/.m2:/var/maven/.m2'
+        }
+    }
+    steps {
+         sh 'mvn -V clean verify'
+    }
+```
diff --git a/docker/maven-build/build.sh b/docker/maven-build/build.sh
deleted file mode 100755
index 2917391..0000000
--- a/docker/maven-build/build.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/bash
-
-# stop execution if any command fails (i.e. exits with status code > 0)
-set -e
-
-# trace commands
-set -x
-
-# Temporary workaround with Surefire on Debian with Java 8 and limit memory usage
-# https://issues.apache.org/jira/browse/SUREFIRE-1588
-# https://stackoverflow.com/questions/53010200/maven-surefire-could-not-find-forkedbooter-class
-export MAVEN_OPTS="-Xmx1024m"
-export _JAVA_OPTIONS="-Djdk.net.URLClassPath.disableClassPathURLCheck=true -Xmx1024m"
-
-mvn -V clean install
-
diff --git a/docker/maven-build/entrypoint.sh b/docker/maven-build/entrypoint.sh
deleted file mode 100755
index b304ee9..0000000
--- a/docker/maven-build/entrypoint.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/bash
-set -e
-
-echo "user:x:$(id -u):$(id -g)::/home/user:/bin/bash" >> /etc/passwd
-export HOME=/home/user
-
-exec "$@"
-
diff --git a/docker/maven-build/files/build.sh b/docker/maven-build/files/build.sh
new file mode 100755
index 0000000..8a55f1e
--- /dev/null
+++ b/docker/maven-build/files/build.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+# Stop execution if any command fails (i.e. exits with status code > 0)
+set -e
+
+# Trace commands
+set -x
+
+# Default Maven build command
+mvn -V clean install
diff --git a/docker/maven-build/files/entrypoint.sh b/docker/maven-build/files/entrypoint.sh
new file mode 100755
index 0000000..7d86052
--- /dev/null
+++ b/docker/maven-build/files/entrypoint.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+# Stop execution if any command fails (i.e. exits with status code > 0)
+set -e
+
+# Inject username with dynamic uid/gid
+echo "hnelson:x:$(id -u):$(id -g)::/home/hnelson:/bin/bash" >> /etc/passwd
+echo "hnelson:x:$(id -g):" >> /etc/group
+export HOME=/home/hnelson
+
+# Start the Xvfb server (required for Studio UI tests)
+export DISPLAY=:99
+Xvfb :99 -screen 0 1024x768x16 &
+
+# Limit memory usage (requried for Java 8 which is not Docker aware)
+export MAVEN_OPTS="-Xmx1024m"
+export _JAVA_OPTIONS="-Xmx1024m"
+
+exec "$@"
diff --git a/docker/maven-build/files/krb5.conf b/docker/maven-build/files/krb5.conf
new file mode 100644
index 0000000..096316a
--- /dev/null
+++ b/docker/maven-build/files/krb5.conf
@@ -0,0 +1,8 @@
+[libdefaults]
+    default_realm = EXAMPLE.COM
+
+[realms]
+    EXAMPLE.COM = {
+        kdc = localhost:60088
+    }
+