Adds initial version of dockerizor recipe
diff --git a/recipe-custom-virgo/README.adoc b/recipe-custom-virgo/README.adoc
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/recipe-custom-virgo/README.adoc
diff --git a/recipe-custom-virgo/README.md b/recipe-custom-virgo/README.md
new file mode 100644
index 0000000..a6ff501
--- /dev/null
+++ b/recipe-custom-virgo/README.md
@@ -0,0 +1 @@
+Please check src/asciidoc/recipe-xyz.adoc for detailed information
diff --git a/recipe-custom-virgo/build.gradle b/recipe-custom-virgo/build.gradle
new file mode 100644
index 0000000..3fe30b0
--- /dev/null
+++ b/recipe-custom-virgo/build.gradle
@@ -0,0 +1,168 @@
+buildscript {
+ repositories {
+ mavenCentral()
+ jcenter()
+ maven {
+ url "https://plugins.gradle.org/m2/"
+ }
+ }
+ dependencies {
+ classpath "gradle.plugin.org.eclipse.virgo.bundlor:bundlor-plugin:0.2"
+ classpath "gradle.plugin.com.eclipsesource.dockerizor:dockerizor:0.6"
+ classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.1'
+ }
+}
+
+apply plugin: 'org.asciidoctor.gradle.asciidoctor'
+
+ext.virgoProjects = [
+ project(':org.eclipse.virgo.samples.recipe.bundle'),
+]
+
+ext.dockerProjects = subprojects.findAll {it.name.contains('-runtime') || it.name.contains('-app')}
+
+configure(virgoProjects + dockerProjects) {
+ repositories {
+ mavenLocal()
+ mavenCentral()
+ ivy {
+ url "http://build.eclipse.org/rt/virgo/ivy/bundles/release/"
+ layout "pattern", { artifact "[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" }
+ }
+ }
+}
+
+configure(virgoProjects) {
+ apply plugin: 'java'
+ apply plugin: 'eclipse'
+ apply plugin: 'eclipse-wtp'
+
+ version = '0.1.0.BUILD-SNAPSHOT'
+
+ compileJava {
+ options.encoding = 'utf-8'
+ options.fork = true
+ doFirst {
+ options.forkOptions.with {
+ executable = 'java'
+ jvmArgs = [
+ '-cp',
+ configurations.ecj.asPath,
+ 'org.eclipse.jdt.internal.compiler.batch.Main',
+ '-source',
+ '1.8',
+ '-target',
+ '1.8',
+ '-warn:-unused'
+ ]
+ }
+ }
+ }
+
+ compileTestJava {
+ options.encoding = 'utf-8'
+ options.fork = true
+ doFirst {
+ options.forkOptions.with {
+ executable = 'java'
+ jvmArgs = [
+ '-cp',
+ configurations.ecj.asPath,
+ 'org.eclipse.jdt.internal.compiler.batch.Main',
+ '-source',
+ '1.8',
+ '-target',
+ '1.8',
+ '-warn:-unused'
+ ]
+ }
+ }
+ }
+
+ eclipse {
+ jdt {
+ sourceCompatibility = 1.8
+ targetCompatibility = 1.8
+ }
+
+ project {
+ natures 'org.eclipse.virgo.ide.facet.core.bundlenature', 'org.eclipse.wst.common.project.facet.core.nature'
+ }
+
+ wtp {
+ facet {
+ facets = []
+ facet name: 'jst.java', version: '1.8'
+ facet name: 'org.eclipse.virgo.server.bundle', version: '1.0'
+ }
+ }
+ }
+
+ configurations { ecj { } }
+
+ dependencies {
+ ecj group: "org.eclipse.jdt.core.compiler", name: "ecj", version: "4.4.2"
+ }
+}
+
+configure(virgoProjects) {
+ apply plugin: 'org.eclipse.virgo.bundlor'
+
+ task('addProjectVersionToGradlePropertiesTask', type: Copy) {
+ ext.outputDir = new File(buildDir, 'bundlor-properties')
+ inputs.file project.rootProject.file('gradle.properties')
+ outputs.dir ext.outputDir
+ from project.rootProject.file('gradle.properties')
+ into ext.outputDir
+ }
+
+ task('mergeClassesAndResources', type: Copy, dependsOn: 'compileJava') {
+ ext.bundlorInputPath = new File(buildDir, 'bundlor-inputPath')
+ inputs.file sourceSets.main.output.classesDir
+ inputs.file sourceSets.main.resources
+ outputs.dir ext.bundlorInputPath
+ from sourceSets.main.output.classesDir
+ from sourceSets.main.resources
+ into ext.bundlorInputPath
+ }
+
+ project.tasks.'bundlor'.dependsOn('addProjectVersionToGradlePropertiesTask', 'mergeClassesAndResources')
+
+ bundlor {
+ ext.bundlorInputPath = new File(buildDir, 'bundlor-inputPath')
+ project.tasks['bundlor'].inputs.file ext.bundlorInputPath
+ manifestTemplatePath = "template.mf"
+ propertiesPath = new File("${project.buildDir}/bundlor-properties/gradle.properties")
+ inputPath = ext.bundlorInputPath
+ failOnWarnings = false
+ }
+}
+
+// tag::dockerizor_confiugration[]
+configure(dockerProjects) {
+
+ apply plugin: 'base' // <1>
+ apply plugin: 'com.eclipsesource.dockerizor' // <2>
+
+ dockerizor {
+ maintainer = 'Florian Waibel <fwaibel@eclipsesource.com>'
+
+ javaImage = 'java:openjdk-8u72-jre' // <3>
+
+ virgoVersion = 'latest'
+ hudsonJobName = 'gradle-build'
+
+ removeAdminConsole = System.properties['local.build'] != 'true'
+
+ virgoFlavour = 'VTS'
+ virgoVersion = 'latest'
+ }
+
+ dockerize.dependsOn configurations.repositoryExt
+ dockerize.dependsOn configurations.repositoryUsr
+}
+// end::dockerizor_confiugration[]
+
+task wrapper(type: Wrapper) {
+ gradleVersion = '2.10'
+}
diff --git a/recipe-custom-virgo/gradle.properties b/recipe-custom-virgo/gradle.properties
new file mode 100644
index 0000000..f04d5b2
--- /dev/null
+++ b/recipe-custom-virgo/gradle.properties
@@ -0,0 +1,4 @@
+springframeworkVersion = 4.2.1.RELEASE
+
+mongoJavaDriverVersion = 2.13.3
+rabbitmqAmqpClientVersion = 3.5.5
diff --git a/recipe-custom-virgo/gradle/wrapper/gradle-wrapper.jar b/recipe-custom-virgo/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..2c6137b
--- /dev/null
+++ b/recipe-custom-virgo/gradle/wrapper/gradle-wrapper.jar
Binary files differ
diff --git a/recipe-custom-virgo/gradle/wrapper/gradle-wrapper.properties b/recipe-custom-virgo/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..c05a838
--- /dev/null
+++ b/recipe-custom-virgo/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Mon Apr 18 10:46:42 CEST 2016
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-bin.zip
diff --git a/recipe-custom-virgo/gradlew b/recipe-custom-virgo/gradlew
new file mode 100755
index 0000000..9d82f78
--- /dev/null
+++ b/recipe-custom-virgo/gradlew
@@ -0,0 +1,160 @@
+#!/usr/bin/env bash
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn ( ) {
+ echo "$*"
+}
+
+die ( ) {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+esac
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
+function splitJvmOpts() {
+ JVM_OPTS=("$@")
+}
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/recipe-custom-virgo/gradlew.bat b/recipe-custom-virgo/gradlew.bat
new file mode 100644
index 0000000..5f19212
--- /dev/null
+++ b/recipe-custom-virgo/gradlew.bat
@@ -0,0 +1,90 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windows variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+if "%@eval[2+2]" == "4" goto 4NT_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+goto execute
+
+:4NT_args
+@rem Get arguments from the 4NT Shell from JP Software
+set CMD_LINE_ARGS=%$
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/recipe-custom-virgo/org.eclipse.virgo.samples.recipe.bundle/build.gradle b/recipe-custom-virgo/org.eclipse.virgo.samples.recipe.bundle/build.gradle
new file mode 100644
index 0000000..7d82dc7
--- /dev/null
+++ b/recipe-custom-virgo/org.eclipse.virgo.samples.recipe.bundle/build.gradle
@@ -0,0 +1,2 @@
+dependencies {
+}
diff --git a/recipe-custom-virgo/org.eclipse.virgo.samples.recipe.bundle/src/main/java/org/eclipse/virgo/samples/recipe/bundle/Greeting.java b/recipe-custom-virgo/org.eclipse.virgo.samples.recipe.bundle/src/main/java/org/eclipse/virgo/samples/recipe/bundle/Greeting.java
new file mode 100644
index 0000000..5b02b60
--- /dev/null
+++ b/recipe-custom-virgo/org.eclipse.virgo.samples.recipe.bundle/src/main/java/org/eclipse/virgo/samples/recipe/bundle/Greeting.java
@@ -0,0 +1,8 @@
+package org.eclipse.virgo.samples.recipe.bundle;
+
+public class Greeting {
+
+ public String sayHello() {
+ return "Hello";
+ }
+}
diff --git a/recipe-custom-virgo/org.eclipse.virgo.samples.recipe.bundle/template.mf b/recipe-custom-virgo/org.eclipse.virgo.samples.recipe.bundle/template.mf
new file mode 100644
index 0000000..0d7bf8d
--- /dev/null
+++ b/recipe-custom-virgo/org.eclipse.virgo.samples.recipe.bundle/template.mf
@@ -0,0 +1,3 @@
+Bundle-Version: 0.1
+Bundle-Name: Virgo Placeholder Bundle
+Bundle-SymbolicName: org.eclipse.virgo.samples.recipe.bundle
diff --git a/recipe-custom-virgo/recipe-custom-virgo-app/build.gradle b/recipe-custom-virgo/recipe-custom-virgo-app/build.gradle
new file mode 100644
index 0000000..da9061f
--- /dev/null
+++ b/recipe-custom-virgo/recipe-custom-virgo-app/build.gradle
@@ -0,0 +1,16 @@
+// tag::custom_virgo_app_configuration[]
+dockerizor {
+ repository = 'virgo-recipe/custom-virgo-app' // <1>
+ description = 'Virgo Recipe custom Virgo created with Gradle Plugin: com.eclipsesource.dockerizor'
+
+ pickupFiles = ['recipe-custom-virgo.plan'] // <2>
+}
+// end::custom_virgo_app_configuration[]
+
+repositories {
+ mavenCentral()
+}
+
+dependencies {
+ repositoryUsr project(':org.eclipse.virgo.samples.recipe.bundle')
+}
diff --git a/recipe-custom-virgo/recipe-custom-virgo-app/recipe-custom-virgo.plan b/recipe-custom-virgo/recipe-custom-virgo-app/recipe-custom-virgo.plan
new file mode 100644
index 0000000..f135e73
--- /dev/null
+++ b/recipe-custom-virgo/recipe-custom-virgo-app/recipe-custom-virgo.plan
@@ -0,0 +1,9 @@
+<plan name="recipe-custom-virgo" version="0.1" scoped="false" atomic="true"
+ xmlns="http://www.eclipse.org/virgo/schema/plan"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://www.eclipse.org/virgo/schema/plan
+ http://www.eclipse.org/virgo/schema/plan/eclipse-virgo-plan.xsd">
+
+ <artifact type="bundle" name="org.eclipse.virgo.samples.recipe.bundle" version="[0.1, 1)" />
+</plan>
diff --git a/recipe-custom-virgo/recipe-custom-virgo-runtime/build.gradle b/recipe-custom-virgo/recipe-custom-virgo-runtime/build.gradle
new file mode 100644
index 0000000..48198d6
--- /dev/null
+++ b/recipe-custom-virgo/recipe-custom-virgo-runtime/build.gradle
@@ -0,0 +1,115 @@
+import groovy.jmx.builder.JmxBuilder
+
+import java.util.HashMap;
+import java.util.Map;
+import java.nio.file.Files
+import java.nio.file.Paths
+
+import javax.management.MBeanServerConnection
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName
+import javax.management.openmbean.CompositeDataSupport;
+import javax.management.openmbean.TabularData
+import javax.management.remote.JMXConnector;
+
+// tag::custom_virgo_runtime_configuration[]
+dockerizor {
+ repository = 'virgo-recipe/custom-virgo-runtime' // <1>
+ description = 'Virgo Recipe Custom Virgo (runtime-only) created with Gradle Plugin: com.eclipsesource.dockerizor'
+
+ createLocalCopy = true // <2>
+}
+// end::custom_virgo_runtime_configuration[]
+
+repositories {
+ mavenCentral()
+}
+
+// tag::custom_virgo_runtime_dependencies[]
+dependencies {
+ repositoryExt("org.mongodb:mongo-java-driver:${mongoJavaDriverVersion}") // <1>
+ repositoryUsr files("com.rabbitmq.amqp.client-${rabbitmqAmqpClientVersion}/build/com.rabbitmq.amqp.client-${rabbitmqAmqpClientVersion}.jar") // <2>
+}
+// end::custom_virgo_runtime_dependencies[]
+
+task unzipRuntime(type: Copy, dependsOn: dockerize) {
+ doLast() {
+ def tarFile = new groovy.util.FileNameByRegexFinder().getFileNames("${->project.buildDir.absolutePath}", /.*\.tar/).get(0)
+ def outputDir = file("${buildDir}")
+
+ from tarTree(tarFile)
+ into outputDir
+ }
+}
+
+// tag::task_start_virgo_runtime[]
+task startVirgoRuntime(type:Exec, dependsOn: unzipRuntime) {
+ workingDir "${buildDir}/virgo"
+
+ //on Uni*
+ commandLine './bin/startup.sh'
+}
+// end::task_start_virgo_runtime[]
+
+// OSGi-ify 3rd party dependencies
+
+subprojects {
+ apply plugin: 'base'
+
+ repositories {
+ mavenCentral()
+ maven { url "http://build.eclipse.org/rt/virgo/maven/bundles/release" }
+ maven { url "http://repository.springsource.com/maven/bundles/external" }
+ }
+
+ configurations {
+ bundlorRuntime
+
+ sourceBundle
+ }
+
+ dependencies {
+ bundlorRuntime('org.eclipse.virgo.bundlor:org.eclipse.virgo.bundlor.commandline:1.1.2.RELEASE')
+ bundlorRuntime('org.eclipse.virgo.bundlor:org.eclipse.virgo.bundlor:1.1.2.RELEASE')
+ bundlorRuntime('org.eclipse.virgo.bundlor:org.eclipse.virgo.bundlor.blint:1.1.2.RELEASE')
+ }
+
+ def artifactName = project.name.split('-')[0]
+ def artifactVersion = project.name.split('-')[1]
+
+ task createBuildDir() {
+ doLast() {
+ file(project.buildDir).mkdir()
+ }
+ }
+
+ def outputFile = new File(file(project.buildDir), "${project.name}.jar")
+
+// tag::task_bundlor[]
+ task bundlor(type: JavaExec, dependsOn: createBuildDir) {
+
+ classpath = configurations.bundlorRuntime
+
+ main = 'org.eclipse.virgo.bundlor.commandline.Bundlor'
+ args '-D', "version=${artifactVersion}"
+ args '-i', "${->configurations.sourceBundle[0]}" // lazy GString to resolve the configuration at runtime
+ args '-m', "${artifactName}.mf"
+ args '-o', outputFile
+ }
+// end::task_bundlor[]
+
+// tag::task_deploy[]
+ task('deploy', dependsOn: bundlor) << {
+ def virgoHome = project.parent.buildDir.absolutePath + "/virgo"
+ System.getProperties().put("javax.net.ssl.trustStore", virgoHome + "/configuration/keystore") // <1>
+ def client = new JmxBuilder().connectorClient(port: 9875, properties:[])
+ client.connect([ 'jmx.remote.credentials' : ['admin', 'admin' ] as String[] ]) // <2>
+ MBeanServerConnection server = client.getMBeanServerConnection()
+ ObjectName deployer = new ObjectName("org.eclipse.virgo.kernel:category=Control,type=Deployer"); // <3>
+ Object deploymentResult = server.invoke(deployer, "deploy", [outputFile.toURI().toString() ] as Object[],
+ [String.class.getName() ] as String[])
+ }
+// end::task_deploy[]
+
+ dockerize.dependsOn bundlor
+}
diff --git a/recipe-custom-virgo/recipe-custom-virgo-runtime/com.rabbitmq.amqp.client-3.5.5/build.gradle b/recipe-custom-virgo/recipe-custom-virgo-runtime/com.rabbitmq.amqp.client-3.5.5/build.gradle
new file mode 100644
index 0000000..79e84c1
--- /dev/null
+++ b/recipe-custom-virgo/recipe-custom-virgo-runtime/com.rabbitmq.amqp.client-3.5.5/build.gradle
@@ -0,0 +1,3 @@
+dependencies {
+ sourceBundle 'com.rabbitmq:amqp-client:3.5.5'
+}
diff --git a/recipe-custom-virgo/recipe-custom-virgo-runtime/com.rabbitmq.amqp.client-3.5.5/com.rabbitmq.amqp.client.mf b/recipe-custom-virgo/recipe-custom-virgo-runtime/com.rabbitmq.amqp.client-3.5.5/com.rabbitmq.amqp.client.mf
new file mode 100644
index 0000000..b00214e
--- /dev/null
+++ b/recipe-custom-virgo/recipe-custom-virgo-runtime/com.rabbitmq.amqp.client-3.5.5/com.rabbitmq.amqp.client.mf
@@ -0,0 +1,10 @@
+Bundle-SymbolicName: com.rabbitmq.amqp.client
+Bundle-Name: RabbitMQ Java AMQP client library
+Bundle-Vendor: Eclipse Virgo
+Bundle-Version: ${version}
+Bundle-ManifestVersion: 2
+Import-Template:
+ javax.security.*;version="0",
+ javax.net.*;version="0"
+Export-Template:
+ com.rabbitmq.*;version="${version}"
diff --git a/recipe-custom-virgo/settings.gradle b/recipe-custom-virgo/settings.gradle
new file mode 100644
index 0000000..3f651ca
--- /dev/null
+++ b/recipe-custom-virgo/settings.gradle
@@ -0,0 +1,8 @@
+// tag::include_bundles[]
+include 'org.eclipse.virgo.samples.recipe.bundle'
+// end::include_bundles[]
+
+// tag::include_dockerized_runtimes[]
+include 'recipe-custom-virgo-runtime'
+include 'recipe-custom-virgo-app'
+// end::include_dockerized_runtimes[]
diff --git a/recipe-custom-virgo/src/docs/asciidoc/recipe-custom-runtime.adoc b/recipe-custom-virgo/src/docs/asciidoc/recipe-custom-runtime.adoc
new file mode 100644
index 0000000..e5fec0d
--- /dev/null
+++ b/recipe-custom-virgo/src/docs/asciidoc/recipe-custom-runtime.adoc
@@ -0,0 +1,172 @@
+:virgo-homepage: https://eclipse.org/virgo
+:guide-short-name: custom-runtime
+:recipe-name: Create a Custom Virgo Runtime with Dockerizor
+:recipe-short-name: recipe-{guide-short-name}
+
+include::../../../../recipe-template/src/asciidoc/00_title.adoc[]
+
+== {recipe-name}
+
+This recipe shows how to create your own custom https://eclipse.org/virgo/[Virgo] runtime.
+
+== Shopping list
+* https://docker.io[Docker] Build, Ship, Run
+* https://gradle.org[Gradle] Build Automation
+* http://www.groovy-lang.org[Groovy] A multi-faceted language for the Java platform
+* https://www.eclipse.org/virgo/documentation/bundlor-documentation-1.1.2.RELEASE/docs/user-guide/html/index.html[Bundlor] Create OSGi Metadata
+* https://github.com/eclipsesource/dockerizor[Dockerizor] - Gradle plug-in to create a Docker image that includes an Eclipse Virgo container
+
+== Ingredients
+* Dockerizor configuration
+* Custom Gradle build tasks
+
+== Preparations
+
+include::../../../../recipe-template/src/asciidoc/051_get-the-code.adoc[]
+include::../../../../recipe-template/src/asciidoc/052_create-recipe-runtime.adoc[]
+include::../../../../recipe-template/src/asciidoc/053_create-eclipse-project-metadata.adoc[]
+include::../../../../recipe-template/src/asciidoc/054_prepare-virgo-tooling.adoc[]
+include::../../../../recipe-template/src/asciidoc/055_import-the-code.adoc[]
+include::../../../../recipe-template/src/asciidoc/056_create-new-virgo-server.adoc[]
+
+== A closer look
+
+This section describes the internal tools and configuration options available for creating a custom Virgo runtime.
+
+=== Shared Dockerizor configuration
+
+The build script +settings.gradle+ includes two Gradle projects for two Virgo runtimes:
+
+.settings.gradle
+[source,groovy,indent=0]
+----
+include::../../../settings.gradle[tags=include_dockerized_runtimes]
+----
+
+First: +recipe-custom-virgo-runtime+ used during development time - without the application bundles.
+And a 2nd one: +recipe-custom-virgo-app+ with the complete application packaged ready for production deployment.
+
+For convenience the shared configuration is done in the root Gradle build script: +build.gradle+:
+
+.build.gradle
+[source,groovy,indent=0]
+----
+include::../../../build.gradle[tags=dockerizor_confiugration]
+----
+<1> Adds the build task +clean+
+<2> Adds the build task +dockerize+
+<3> Docker base image
+
+=== Create the development time variant
+
+.build.gradle
+[source,groovy,indent=0]
+----
+include::../../../recipe-custom-virgo-runtime/build.gradle[tags=custom_virgo_runtime_configuration]
+----
+<1> Name of the generated Docker image
+<2> Creates local copy +${buildDir}/virgo-\{timestamp\}.tar+
+
+In the +dependencies+ section the provisioning of +repository/ext+ and +repository/usr+ takes place.
+The following sample demonstrates how to add:
+
+* an OSGi-ready library and
+* a library bundled during the custom runtime build.
+
+.build.gradle
+[source,groovy,indent=0]
+----
+include::../../../recipe-custom-virgo-runtime/build.gradle[tags=custom_virgo_runtime_dependencies]
+----
+<1> Adds OSGi-ready MongoDB driver available from Maven Central
+<2> Adds bundled RabbitMQ client from local build
+
+The task +startVirgoRuntime+ defined in the few Groovy lines:
+
+.build.gradle
+[source,groovy,indent=0]
+----
+include::../../../recipe-custom-virgo-runtime/build.gradle[tags=task_start_virgo_runtime]
+----
+
+allow to test drive the Virgo runtime
+
+[source,sh]
+----
+$ ./gradlew :recipe-custom-virgo-runtime:startVirgoRuntime
+----
+
+=== Bundle and deploy non OSGi-ready dependencies
+
+To be able to create and verify non OSGi-ready dependencies we need to
+
+* create OSGi metadata and
+* deploy the bundled jar file.
+
+Thus we added the tasks +bundlor+...
+
+[source,groovy,indent=0]
+----
+include::../../../recipe-custom-virgo-runtime/build.gradle[tags=task_bundlor]
+----
+
+and +deploy+.
+
+The +bundlor+ task creates OSGi metadata for a library specified via +sourceBundle+ inside the corresponding +build.gradle+.
+Let's say you want to bundle the RabbitMQ AMQP Client 3.5.5 available from Maven Central:
+
+.build.gradle
+[source,groovy,indent=0]
+----
+include::../../../recipe-custom-virgo-runtime/com.rabbitmq.amqp.client-3.5.5/build.gradle[]
+----
+
+from a +MANIFEST.MF+ template file:
+
+.com.rabbitmq.amqp.client.mf
+[source,txt]
+----
+include::../../../recipe-custom-virgo-runtime/com.rabbitmq.amqp.client-3.5.5/com.rabbitmq.amqp.client.mf[]
+----
+
+For more details about the Bundlor +template.mf+ syntax please see the https://www.eclipse.org/virgo/documentation/bundlor-documentation-1.1.2.RELEASE/docs/user-guide/html/index.html[Bundlor User Guide].
+
+The deploy task performs the deployment via JMX with a small portion of Groovy code:
+
+.build.gradle
+[source,groovy,indent=0]
+----
+include::../../../recipe-custom-virgo-runtime/build.gradle[tags=task_deploy]
+----
+<1> Configure SSL trust store
+<2> Create JMX client with Virgo default credentials
+<3> Create Virgo JMX deployer
+
+To deploy the generated bundle into a running sample runtime you can run the Gradle task +deploy+ like this:
+
+[source,sh]
+----
+$ ./gradlew :recipe-custom-virgo-runtime:com.rabbitmq.amqp.client-3.5.5:deploy
+----
+
+include::../../../../recipe-template/src/asciidoc/08_dockerize_recipe.adoc[]
+
+Virgo plan are a proven way to add the application bundles to a Virgo runtime.
+The snippet below shows the Gradle build file (Dockerizor configuration) needed to add such a plan file.
+
+.build.gradle
+[source,groovy,indent=0]
+----
+include::../../../recipe-custom-virgo-app/build.gradle[tags=custom_virgo_app_configuration]
+----
+<1> Name of the generated Docker image
+<2> Adds Virgo plan file to the Docker image
+
+Once the image is built with +./gradlew dockerize+ it can be started with Docker:
+
+[source,sh]
+----
+$ docker run -it --rm virgo-recipe/custom-virgo-app
+----
+
+Congratulations. You've successfully containerized your Virgo applications.
diff --git a/recipe-template/src/asciidoc/00_title.adoc b/recipe-template/src/docs/asciidoc/00_title.adoc
similarity index 100%
rename from recipe-template/src/asciidoc/00_title.adoc
rename to recipe-template/src/docs/asciidoc/00_title.adoc
diff --git a/recipe-template/src/asciidoc/01_acknowledgements.adoc b/recipe-template/src/docs/asciidoc/01_acknowledgements.adoc
similarity index 100%
rename from recipe-template/src/asciidoc/01_acknowledgements.adoc
rename to recipe-template/src/docs/asciidoc/01_acknowledgements.adoc
diff --git a/recipe-template/src/asciidoc/03_shopping-list.adoc b/recipe-template/src/docs/asciidoc/03_shopping-list.adoc
similarity index 100%
rename from recipe-template/src/asciidoc/03_shopping-list.adoc
rename to recipe-template/src/docs/asciidoc/03_shopping-list.adoc
diff --git a/recipe-template/src/asciidoc/04_ingredients.adoc b/recipe-template/src/docs/asciidoc/04_ingredients.adoc
similarity index 100%
rename from recipe-template/src/asciidoc/04_ingredients.adoc
rename to recipe-template/src/docs/asciidoc/04_ingredients.adoc
diff --git a/recipe-template/src/asciidoc/051_get-the-code.adoc b/recipe-template/src/docs/asciidoc/051_get-the-code.adoc
similarity index 100%
rename from recipe-template/src/asciidoc/051_get-the-code.adoc
rename to recipe-template/src/docs/asciidoc/051_get-the-code.adoc
diff --git a/recipe-template/src/asciidoc/052_create-recipe-runtime.adoc b/recipe-template/src/docs/asciidoc/052_create-recipe-runtime.adoc
similarity index 100%
rename from recipe-template/src/asciidoc/052_create-recipe-runtime.adoc
rename to recipe-template/src/docs/asciidoc/052_create-recipe-runtime.adoc
diff --git a/recipe-template/src/asciidoc/053_create-eclipse-project-metadata.adoc b/recipe-template/src/docs/asciidoc/053_create-eclipse-project-metadata.adoc
similarity index 100%
rename from recipe-template/src/asciidoc/053_create-eclipse-project-metadata.adoc
rename to recipe-template/src/docs/asciidoc/053_create-eclipse-project-metadata.adoc
diff --git a/recipe-template/src/asciidoc/054_prepare-virgo-tooling.adoc b/recipe-template/src/docs/asciidoc/054_prepare-virgo-tooling.adoc
similarity index 100%
rename from recipe-template/src/asciidoc/054_prepare-virgo-tooling.adoc
rename to recipe-template/src/docs/asciidoc/054_prepare-virgo-tooling.adoc
diff --git a/recipe-template/src/asciidoc/055_import-the-code.adoc b/recipe-template/src/docs/asciidoc/055_import-the-code.adoc
similarity index 100%
rename from recipe-template/src/asciidoc/055_import-the-code.adoc
rename to recipe-template/src/docs/asciidoc/055_import-the-code.adoc
diff --git a/recipe-template/src/asciidoc/056_create-new-virgo-server.adoc b/recipe-template/src/docs/asciidoc/056_create-new-virgo-server.adoc
similarity index 100%
rename from recipe-template/src/asciidoc/056_create-new-virgo-server.adoc
rename to recipe-template/src/docs/asciidoc/056_create-new-virgo-server.adoc
diff --git a/recipe-template/src/asciidoc/08_dockerize_recipe.adoc b/recipe-template/src/docs/asciidoc/08_dockerize_recipe.adoc
similarity index 100%
rename from recipe-template/src/asciidoc/08_dockerize_recipe.adoc
rename to recipe-template/src/docs/asciidoc/08_dockerize_recipe.adoc
diff --git a/recipe-template/src/asciidoc/recipe-xyz.adoc b/recipe-template/src/docs/asciidoc/recipe-xyz.adoc
similarity index 100%
rename from recipe-template/src/asciidoc/recipe-xyz.adoc
rename to recipe-template/src/docs/asciidoc/recipe-xyz.adoc