Vargant support and extended build file
diff --git a/build.gradle b/build.gradle
index 1743e41..737cd30 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,32 +1,79 @@
 /*
- * This build file was auto generated by running the Gradle 'init' task
- * by 'zsolt' at '9/8/16 1:51 PM' with Gradle 2.12
+ * Copyright 2016 the original author or authors.
  *
- * This generated file contains a commented-out sample Java project to get you started.
- * For more details take a look at the Java Quickstart chapter in the Gradle
- * user guide available at https://docs.gradle.org/2.12/userguide/tutorial_java_projects.html
+ * Licensed 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.
  */
+import org.opencord.gradle.rules.*
+import org.yaml.snakeyaml.Yaml
 
-/*
-// Apply the java plugin to add support for Java
-apply plugin: 'java'
+allprojects {
+    apply plugin: 'base'
+    apply plugin: 'de.gesellix.docker'
 
-// In this section you declare where to find the dependencies of your project
-repositories {
-    // Use 'jcenter' for resolving your dependencies.
-    // You can declare any Maven/Ivy/file repository here.
-    jcenter()
+    docker {
+        // dockerHost = System.env.DOCKER_HOST ?: 'unix:///var/run/docker.sock'
+        // dockerHost = System.env.DOCKER_HOST ?: 'https://192.168.99.100:2376'
+        // certPath = System.getProperty('docker.cert.path') ?: "${System.getProperty('user.home')}/.docker/machine/machines/default"
+        // authConfigPlain = [
+        //   "username"       : "joe",
+        //   "password"       : "some-pw-as-needed",
+        //   "email"          : "joe@acme.com",
+        //   "serveraddress"  : "https://index.docker.io/v1/"
+        //  ]
+    }
 }
 
-// In this section you declare the dependencies for your production and test code
-dependencies {
-    // The production code uses the SLF4J logging API at compile time
-    compile 'org.slf4j:slf4j-api:1.7.18'
+ext {
 
-    // Declare the dependency for your favourite test framework you want to use in your tests.
-    // TestNG is also supported by the Gradle Test task. Just change the
-    // testCompile dependency to testCompile 'org.testng:testng:6.8.1' and add
-    // 'test.useTestNG()' to your build script.
-    testCompile 'junit:junit:4.12'
+    // Target registry to be used to publish docker images needed for deployment
+    targetReg = project.hasProperty('targetReg') ? project.getProperty('targetReg') : 'localhost:5000'
+
+    // The tag used to tag the docker images push to the target registry
+    targetTag = project.hasProperty('targetTag') ? project.getProperty('targetTag') : 'candidate'
+
+    // Deployment target config file (yaml format); this can be overwritten from the command line
+    // using the -PdeployConfig=<file-path> syntax.
+    deployConfig = project.hasProperty('deployConfig') ? project.getProperty('deployConfig') : './config/default.yml'
+
+    dockerPath = project.hasProperty('dockerPath') ? project.getProperty('dockerPath') : '/usr/bin'
+
 }
-*/
+
+// ~~~~~~~~~~~~~~~~~~~ Global tasks ~~~~~~~~~~~~~~~~~~~~~~~
+
+// To be used to fetch upstream binaries, clone repos, etc.
+task fetch {
+    // ...
+}
+
+// To be used to generate all needed binaries that need to be present on the target
+// as docker images in the local docker runner.
+task buildImages(type: Exec) {
+    commandLine "$dockerPath/docker", 'build', '-t', 'cord/voltha', '-f', 'Dockerfile', '.'
+}
+
+task tagImage(type: Exec) {
+   dependsOn buildImages
+   commandLine "$dockerPath/docker", 'tag', 'cord/voltha', "$targetReg/cord/voltha:$targetTag"
+}
+
+// Publish image(s) built during the build step into targetReg registry using the targetTag
+// tag. See maas subproject for examples on how to do this.
+task publishImages(type: Exec) {
+    dependsOn tagImage
+    commandLine "$dockerPath/docker", 'push', "$targetReg/cord/voltha:$targetTag"
+}
+
+task publish {
+    dependsOn publishImages
+}