Merge docker
diff --git a/openldap/Dockerfile b/openldap/Dockerfile
new file mode 100644
index 0000000..513db10
--- /dev/null
+++ b/openldap/Dockerfile
@@ -0,0 +1,47 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+FROM alpine
+
+RUN apk add --no-cache openldap openldap-back-hdb openldap-clients openssl
+
+ADD slapd-config.ldif slapd-data.ldif /tmp/
+
+# Generate a self-signed SSL certificate
+RUN openssl req -newkey rsa:4096 -sha512 -x509 -days 3650 -nodes \
+ -subj "/C=NA/ST=NA/L=NA/O=NA/CN=example.com" \
+ -out /etc/ssl/certs/ldap.pem -keyout /etc/ssl/private/ldap.pem && \
+ chown root:ldap /etc/ssl/private/ldap.pem && \
+ chmod 640 /etc/ssl/private/ldap.pem
+
+# Inject configuration
+RUN mkdir /etc/openldap/slapd.d && \
+ slapadd -d -1 -F /etc/openldap/slapd.d -n 0 -l /tmp/slapd-config.ldif
+
+# Inject data
+RUN slapadd -d 1 -F /etc/openldap/slapd.d -l /tmp/slapd-data.ldif
+
+# Fix permissions
+RUN chown -R ldap:ldap /var/lib/openldap && \
+ chown -R ldap:ldap /etc/openldap/slapd.d
+
+EXPOSE 389 636
+
+CMD /usr/sbin/slapd -d 256 -u ldap -g ldap -F /etc/openldap/slapd.d -h "ldap:/// ldaps:///"
+
diff --git a/openldap/README.md b/openldap/README.md
new file mode 100644
index 0000000..651dc7c
--- /dev/null
+++ b/openldap/README.md
@@ -0,0 +1,37 @@
+> Licensed to the Apache Software Foundation (ASF) under one
+> or more contributor license agreements. See the NOTICE file
+> distributed with this work for additional information
+> regarding copyright ownership. The ASF licenses this file
+> to you under the Apache License, Version 2.0 (the
+> "License"); you may not use this file except in compliance
+> with the License. You may obtain a copy of the License at
+>
+> http://www.apache.org/licenses/LICENSE-2.0
+>
+> Unless required by applicable law or agreed to in writing,
+> software distributed under the License is distributed on an
+> "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+> KIND, either express or implied. See the License for the
+> specific language governing permissions and limitations
+> under the License.
+
+
+# About
+
+A docker image to run OpenLDAP.
+
+
+## Build image
+
+ docker build -t apachedirectory/openldap .
+
+
+## Publish image
+
+ docker push apachedirectory/openldap
+
+
+## Usage
+
+ docker run -d -p 389:389 -p 636:636 apachedirectory/openldap
+
diff --git a/openldap/slapd-config.ldif b/openldap/slapd-config.ldif
new file mode 100644
index 0000000..4e511b5
--- /dev/null
+++ b/openldap/slapd-config.ldif
@@ -0,0 +1,34 @@
+dn: cn=config
+objectClass: olcGlobal
+cn: config
+olcArgsFile: /var/lib/openldap/run/slapd.args
+olcPidFile: /var/lib/openldap/run/slapd.pid
+olcTLSCACertificateFile: /etc/ssl/certs/ldap.pem
+olcTLSCertificateFile: /etc/ssl/certs/ldap.pem
+olcTLSCertificateKeyFile: /etc/ssl/private/ldap.pem
+
+dn: cn=schema,cn=config
+objectClass: olcSchemaConfig
+cn: schema
+
+include: file:///etc/openldap/schema/core.ldif
+
+include: file:///etc/openldap/schema/cosine.ldif
+
+include: file:///etc/openldap/schema/inetorgperson.ldif
+
+dn: olcDatabase=frontend,cn=config
+objectClass: olcDatabaseConfig
+objectClass: olcFrontendConfig
+olcDatabase: frontend
+
+dn: olcDatabase=mdb,cn=config
+objectClass: olcDatabaseConfig
+objectClass: olcMdbConfig
+olcDatabase: mdb
+olcSuffix: dc=example,dc=com
+olcRootDN: cn=admin,dc=example,dc=com
+olcRootPW: secret
+olcDbDirectory: /var/lib/openldap/openldap-data
+olcDbIndex: objectClass eq
+
diff --git a/openldap/slapd-data.ldif b/openldap/slapd-data.ldif
new file mode 100644
index 0000000..7ca7d76
--- /dev/null
+++ b/openldap/slapd-data.ldif
@@ -0,0 +1,5 @@
+dn: dc=example,dc=com
+objectclass: domain
+objectclass: top
+dc: example
+
diff --git a/studio-build/Dockerfile b/studio-build/Dockerfile
new file mode 100644
index 0000000..7e29954
--- /dev/null
+++ b/studio-build/Dockerfile
@@ -0,0 +1,46 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+FROM maven
+
+ENV DEBIAN_FRONTEND=noninteractive
+RUN apt-get update
+RUN apt-get install -y --no-install-recommends xvfb
+RUN apt-get install -y --no-install-recommends krb5-config krb5-user
+
+# Create home directory
+RUN mkdir /home/hnelson && chmod 777 /home/hnelson
+WORKDIR /home/hnelson
+
+# Add krb5.conf with EXAMPLE.COM domain
+ADD krb5.conf /etc/
+
+# Make /etc/passwd writeable to be able to inject username with dynamic uid/gid
+RUN chmod 666 /etc/passwd
+
+# Add and configure entrypoint script
+ADD entrypoint.sh /usr/local/bin
+RUN chmod 755 /usr/local/bin/entrypoint.sh
+ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
+
+# Add build script and make it the default command
+ADD build-studio-with-ui-tests.sh /usr/local/bin
+RUN chmod 755 /usr/local/bin/build-studio-with-ui-tests.sh
+CMD "/usr/local/bin/build-studio-with-ui-tests.sh"
+
diff --git a/studio-build/README.md b/studio-build/README.md
new file mode 100644
index 0000000..48af056
--- /dev/null
+++ b/studio-build/README.md
@@ -0,0 +1,66 @@
+> Licensed to the Apache Software Foundation (ASF) under one
+> or more contributor license agreements. See the NOTICE file
+> distributed with this work for additional information
+> regarding copyright ownership. The ASF licenses this file
+> to you under the Apache License, Version 2.0 (the
+> "License"); you may not use this file except in compliance
+> with the License. You may obtain a copy of the License at
+>
+> http://www.apache.org/licenses/LICENSE-2.0
+>
+> Unless required by applicable law or agreed to in writing,
+> software distributed under the License is distributed on an
+> "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+> KIND, either express or implied. See the License for the
+> specific language governing permissions and limitations
+> under the License.
+
+
+# About
+
+A docker image to run Apache Directory Studio build included full test suite within a docker container.
+
+It contains all requirements:
+* Java 8
+* Maven 3
+* Xvfb (for running UI tests)
+* LDAP client
+* Kerberos client
+
+
+## Build image
+
+ docker build -t apachedirectory/studio-build .
+
+
+## Publish image
+
+ docker push apachedirectory/studio-build
+
+
+## Usage
+
+Local
+
+ PATH_TO_STUDIO_SRC=...
+ docker run -it --rm \
+ -u $(id -u):$(id -g) \
+ -e HOME=/home/hnelson \
+ -v ~/.m2:/home/hnelson/.m2 \
+ -v $PATH_TO_STUDIO_SRC:/home/hnelson/studio \
+ apachedirectory/studio-build bash
+
+ cd /home/hnelson/studio
+ mvn -f pom-first.xml clean install
+ mvn clean install -Denable-ui-tests
+
+
+On Jenkins
+
+ docker run -i --rm \
+ -u $(id -u):$(id -g) \
+ -e HOME=/home/hnelson \
+ -v $(pwd):/home/hnelson/studio \
+ apachedirectory/studio-build
+
+
diff --git a/studio-build/build-studio-with-ui-tests.sh b/studio-build/build-studio-with-ui-tests.sh
new file mode 100755
index 0000000..bea75cf
--- /dev/null
+++ b/studio-build/build-studio-with-ui-tests.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+# stop execution if any command fails (i.e. exits with status code > 0)
+set -e
+
+# trace commands
+set -x
+
+cd /home/hnelson/studio
+mvn -V -f pom-first.xml clean install
+mvn -V clean install -Denable-ui-tests
+
diff --git a/studio-build/entrypoint.sh b/studio-build/entrypoint.sh
new file mode 100755
index 0000000..7cb2f71
--- /dev/null
+++ b/studio-build/entrypoint.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+set -e
+
+export DISPLAY=:99
+Xvfb :99 -screen 0 1024x768x16 &
+
+echo "hnelson:x:$(id -u):$(id -g)::/home/hnelson:/bin/bash" >> /etc/passwd
+
+exec "$@"
+
diff --git a/studio-build/krb5.conf b/studio-build/krb5.conf
new file mode 100644
index 0000000..096316a
--- /dev/null
+++ b/studio-build/krb5.conf
@@ -0,0 +1,8 @@
+[libdefaults]
+ default_realm = EXAMPLE.COM
+
+[realms]
+ EXAMPLE.COM = {
+ kdc = localhost:60088
+ }
+
diff --git a/studio-build/mvn b/studio-build/mvn
new file mode 100755
index 0000000..58f91f0
--- /dev/null
+++ b/studio-build/mvn
@@ -0,0 +1,5 @@
+#!/bin/bash
+echo "$@"
+echo "$HOME"
+/usr/bin/mvn -Duser.home=$HOME "$@"
+
diff --git a/xvfb/Dockerfile b/xvfb/Dockerfile
new file mode 100644
index 0000000..92ceaa8
--- /dev/null
+++ b/xvfb/Dockerfile
@@ -0,0 +1,27 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+FROM alpine
+
+RUN apk add --no-cache xvfb
+
+ENV DISPLAY :6
+
+CMD Xvfb $DISPLAY -ac -listen tcp -screen 0 1024x768x16
+
diff --git a/xvfb/README.md b/xvfb/README.md
new file mode 100644
index 0000000..8c9e476
--- /dev/null
+++ b/xvfb/README.md
@@ -0,0 +1,49 @@
+> Licensed to the Apache Software Foundation (ASF) under one
+> or more contributor license agreements. See the NOTICE file
+> distributed with this work for additional information
+> regarding copyright ownership. The ASF licenses this file
+> to you under the Apache License, Version 2.0 (the
+> "License"); you may not use this file except in compliance
+> with the License. You may obtain a copy of the License at
+>
+> http://www.apache.org/licenses/LICENSE-2.0
+>
+> Unless required by applicable law or agreed to in writing,
+> software distributed under the License is distributed on an
+> "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+> KIND, either express or implied. See the License for the
+> specific language governing permissions and limitations
+> under the License.
+
+
+# About
+
+A docker image to run Xvfb within a docker container and make an X11 server available to the host.
+
+Used to run Apache Directory Studio UI tests on Jenkins.
+
+
+## Build image
+
+ docker build -t apachedirectory/xvfb .
+
+
+## Publish image
+
+ docker push apachedirectory/xvfb
+
+
+## Usage
+
+ CONTAINER_NAME="dir-studio-ui-tests-xvfb"
+ for PORT in $(seq 6006 6099); do netstat -tln | grep $PORT || break; done
+ echo "Using TCP port $PORT for Xvfb"
+ export DISPLAY=:$((PORT-6000))
+ echo "Using DISPLAY $DISPLAY"
+ docker run -d --name $CONTAINER_NAME -e DISPLAY=$DISPLAY -p $PORT:$PORT apachedirectory/xvfb
+ xdpyinfo -display $DISPLAY
+ mvn clean install -Denable-ui-tests
+ docker stop $CONTAINER_NAME
+ docker rm $CONTAINER_NAME
+
+