[CCSDK-29]changes for dgbuilder docker image

changes related to creating docker
container for dgbuilder

Change-Id: Ida8710be20c6737c46f7f01bc36e0fe11dd250bb
Issue-ID:{CCSDK-29}
Signed-off-by: Chinthakayala, Sheshashailavas (sc2914) <sc2914@att.com>
diff --git a/dgbuilder-docker/flowShareUsers.js b/dgbuilder-docker/flowShareUsers.js
new file mode 100644
index 0000000..4cbf739
--- /dev/null
+++ b/dgbuilder-docker/flowShareUsers.js
@@ -0,0 +1,8 @@
+module.exports = {"flowShareUsers":
+	[
+	{
+          "name" : "Release 1702",
+          "rootDir" : "1702"
+	}
+	]
+}
diff --git a/dgbuilder-docker/pom.xml b/dgbuilder-docker/pom.xml
new file mode 100644
index 0000000..4e72461
--- /dev/null
+++ b/dgbuilder-docker/pom.xml
@@ -0,0 +1,232 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+	<parent>
+		<groupId>org.onap.ccsdk.distribution</groupId>
+    		<artifactId>distribution-root</artifactId>
+    		<version>0.1.0-SNAPSHOT</version>
+	</parent>
+
+	<modelVersion>4.0.0</modelVersion>
+	<packaging>pom</packaging>
+	<groupId>org.onap.ccsdk.distribution</groupId>
+	<artifactId>distribution-dgbuilder-docker</artifactId>
+    	<version>0.1.0-SNAPSHOT</version>
+
+	<name>Distribution - dgbuilder-docker</name>
+	<description>Creates docker container for dgbuilder</description>
+
+	<properties>
+		<image.name>onap/ccsdk-dgbuilder-image</image.name>
+		<ccsdk.project.version>${project.version}</ccsdk.project.version>
+	</properties>
+
+
+	<build>
+		<plugins>
+
+
+            <plugin>
+                <groupId>org.codehaus.groovy.maven</groupId>
+                <artifactId>gmaven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <phase>validate</phase>
+                        <goals>
+                            <goal>execute</goal>
+                        </goals>
+                        <configuration>
+                            <source>
+                                println project.properties['ccsdk.project.version'];
+                                def versionArray;
+                                if ( project.properties['ccsdk.project.version'] != null ) {
+                                    versionArray = project.properties['ccsdk.project.version'].split('\\.');
+                                }
+
+                                if (project.properties['ccsdk.project.version'].endsWith("-SNAPSHOT"))
+                                {
+                                    project.properties['project.docker.latesttag.version']=versionArray[0]  + '.' + versionArray[1] + "-STAGING-latest";
+                                } else {
+                                    project.properties['project.docker.latesttag.version']=versionArray[0] + '.' + versionArray[1] + "-STAGING-latest";
+                                }
+
+                                println 'New Tag for docker:' +
+                                project.properties['project.docker.latesttag.version'];
+                            </source>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+			<plugin>
+				<artifactId>maven-resources-plugin</artifactId>
+				<version>2.6</version>
+				<executions>
+					<execution>
+						<id>copy-dockerfile</id>
+						<goals>
+							<goal>copy-resources</goal>
+						</goals><!-- here the phase you need -->
+						<phase>validate</phase>
+						<configuration>
+							<outputDirectory>${basedir}/target/docker-stage</outputDirectory>
+							<resources>
+								<resource>
+									<directory>src/main/docker</directory>
+									<includes>
+										<include>Dockerfile</include>
+									</includes>
+									<filtering>true</filtering>
+								</resource>
+							</resources>
+						</configuration>
+					</execution>
+				</executions>
+			</plugin>
+
+			<plugin>
+				<artifactId>exec-maven-plugin</artifactId>
+				<groupId>org.codehaus.mojo</groupId>
+				<version>1.5.0</version>
+				<executions>
+                    			<execution>
+                        			<id>Make-stage-dir</id>
+                        			<phase>generate-sources</phase>
+                        			<goals>
+                            				<goal>exec</goal>
+                        			</goals>
+                        			<configuration>
+                            				<executable>/bin/mkdir</executable>
+                            				<arguments>
+                                			<argument>-p</argument>
+                                			<argument>${basedir}/target/docker-stage/opt/onap/sdnc</argument>
+                            				</arguments>
+                        			</configuration>
+                    			</execution>
+                    			<execution>
+                        			<id>Unzip dgbuilder</id>
+                        			<phase>generate-sources</phase>
+                        			<goals>
+                            				<goal>exec</goal>
+                        			</goals>
+                        			<configuration>
+                            				<executable>/usr/bin/unzip</executable>
+                            				<arguments>
+                                			<argument>-d</argument>
+                                			<argument>${basedir}/target/docker-stage/opt/onap/sdnc</argument>
+                                			<argument>../dgbuilder/target/*.zip</argument>
+                            				</arguments>
+                        			</configuration>
+                    			</execution>
+					<execution>
+						<id>Copy dgbuilder</id>
+						<phase>generate-sources</phase>
+						<goals>
+							<goal>exec</goal>
+						</goals>
+						<configuration>
+							<executable>/bin/cp</executable>
+							<arguments>
+								<argument>-r</argument>
+								<argument>../dgbuilder</argument>
+								<argument>${basedir}/target/docker-stage/opt/onap/sdnc</argument>
+							</arguments>
+						</configuration>
+					</execution>
+
+					<execution>
+						<id>dgbuilder createReleaseDir</id>
+						<phase>generate-sources</phase>
+						<goals>
+							<goal>exec</goal>
+						</goals>
+						<configuration>
+							<executable>/bin/bash</executable>
+							<arguments>
+								<argument>${basedir}/target/docker-stage/opt/onap/sdnc/dgbuilder/createReleaseDir.sh</argument>
+								<argument>1702</argument>
+								<argument>dguser</argument>
+								<argument>change_email_id@dgbuilder.com</argument>
+							</arguments>
+						</configuration>
+					</execution>
+
+					<execution>
+						<id>change shell permissions</id>
+                        			<phase>process-sources</phase>
+						<goals>
+							<goal>exec</goal>
+						</goals>
+						<configuration>
+							<executable>/usr/bin/find</executable>
+							<arguments>
+								<argument>${basedir}/target/docker-stage/opt/onap/sdnc</argument>
+								<argument>-name</argument>
+								<argument>*.sh</argument>
+								<argument>-exec</argument>
+								<argument>chmod</argument>
+								<argument>+x</argument>
+								<argument>{}</argument>
+								<argument>;</argument>
+							</arguments>
+						</configuration>
+					</execution>
+				</executions>
+			</plugin>
+		</plugins>
+    </build>
+    <profiles>
+        <profile>
+            <id>docker</id>
+            <build>
+                <plugins>
+			<plugin>
+				<groupId>io.fabric8</groupId>
+				<artifactId>docker-maven-plugin</artifactId>
+				<version>0.16.5</version>
+				<inherited>false</inherited>
+				<configuration>
+
+					<images>
+                                		<image>
+                                    			<name>${image.name}</name>
+                                    			<build>
+                                        			<cleanup>try</cleanup>
+                                        			<dockerFileDir>${basedir}/target/docker-stage</dockerFileDir>
+                                        			<dockerFile>${basedir}/target/docker-stage/Dockerfile</dockerFile>
+                                        			<tags>
+                                            				<tag>${project.version}</tag>
+                                            				<tag>${project.version}-STAGING-${maven.build.timestamp}</tag>
+                                            				<tag>${project.docker.latesttag.version}</tag>
+                                        			</tags>
+                                    			</build>
+						</image>
+					</images>
+				</configuration>
+				<executions>
+					<execution>
+						<id>generate-images</id>
+						<phase>package</phase>
+						<goals>
+							<goal>build</goal>
+						</goals>
+					</execution>
+
+					<execution>
+						<id>push-images</id>
+						<phase>deploy</phase>
+						<goals>
+							<goal>build</goal>
+							<goal>push</goal>
+						</goals>
+					</execution>
+				</executions>
+			</plugin>
+		</plugins>
+	</build>
+        </profile>
+    </profiles>
+	<organization>
+		<name>ONAP</name>
+	</organization>
+</project>
diff --git a/dgbuilder-docker/releases/1702/conf/svclogic.properties b/dgbuilder-docker/releases/1702/conf/svclogic.properties
new file mode 100644
index 0000000..92d997f
--- /dev/null
+++ b/dgbuilder-docker/releases/1702/conf/svclogic.properties
@@ -0,0 +1,5 @@
+org.onap.ccsdk.sli.dbtype=jdbc
+org.onap.ccsdk.sli.jdbc.url=jdbc:mysql://dbhost:3306/sdnctl
+org.onap.ccsdk.sli.jdbc.database=sdnctl
+org.onap.ccsdk.sli.jdbc.user=sdnctl
+org.onap.ccsdk.sli.jdbc.password=gamma
diff --git a/dgbuilder-docker/releases/1702/customSettings.js b/dgbuilder-docker/releases/1702/customSettings.js
new file mode 100644
index 0000000..b67d091
--- /dev/null
+++ b/dgbuilder-docker/releases/1702/customSettings.js
@@ -0,0 +1,20 @@
+module.exports = {
+		'name' : 'Release 1702',
+		'emailAddress' :'change_email_id@dgbuilder.com',
+		'uiPort' :3100,
+		'mqttReconnectTime': 15000,
+		'serialReconnectTime' : 15000,
+		'debugMaxLength': 1000,
+		'htmlPath': 'releases/1702/html/',
+		'xmlPath': 'releases/1702/xml/',
+		'flowFile' : 'releases/1702/flows/flows.json',
+		'sharedDir': 'releases/1702/flows/shared',
+		'userDir' : 'releases/1702',
+		'httpAuth': {user:'dguser',pass:'cc03e747a6afbbcbf8be7668acfebee5'},
+		'dbHost': 'dbhost',
+		'dbPort': '3306',
+		'dbName': 'sdnctl',
+		'dbUser': 'sdnctl',
+		'dbPassword': 'gamma',
+		'gitLocalRepository': ''
+		}
diff --git a/dgbuilder-docker/src/main/docker/Dockerfile b/dgbuilder-docker/src/main/docker/Dockerfile
new file mode 100644
index 0000000..bb6e274
--- /dev/null
+++ b/dgbuilder-docker/src/main/docker/Dockerfile
@@ -0,0 +1,13 @@
+# Base ubuntu with added packages needed for open ecomp
+FROM onap/ubuntu-sdnc-image:${project.version}
+MAINTAINER SDN-C Team (sdnc@lists.onap.org)
+
+# copy onap
+COPY opt /opt
+WORKDIR /opt/onap/sdnc/dgbuilder
+# Set the proxy if needed
+# RUN npm config set proxy http://your.proxy.com:8080
+#RUN npm install
+
+#ENTRYPOINT /bin/bash /opt/onap/sdnc/dgbuilder/start sdnc1.0
+EXPOSE 3100
diff --git a/dgbuilder/pom.xml b/dgbuilder/pom.xml
index 8830031..e1cde5a 100644
--- a/dgbuilder/pom.xml
+++ b/dgbuilder/pom.xml
@@ -11,11 +11,11 @@
 	<modelVersion>4.0.0</modelVersion>
 	<packaging>pom</packaging>
 	<groupId>org.onap.ccsdk.distribution</groupId>
-	<artifactId>dgbuilder</artifactId>
+	<artifactId>distribution-dgbuilder</artifactId>
 
 	<version>0.1.0-SNAPSHOT</version>
 
-	<name>Directed Graph Builder</name>
+	<name>Distribution - dgbuilder</name>
 	<description>Directed Graph Builder</description>
 
 	<properties>
diff --git a/pom.xml b/pom.xml
index 525f231..3fc8732 100644
--- a/pom.xml
+++ b/pom.xml
@@ -32,5 +32,6 @@
         <module>opendaylight</module>
         <module>odlsli</module>
         <module>dgbuilder</module>
+        <module>dgbuilder-docker</module>
     </modules>
 </project>