Rename dgbuilder dockerfile names to CCSDK
[ccsdk/distribution.git] / dgbuilder-docker / pom.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
4
5         <parent>
6                 <groupId>org.onap.ccsdk.distribution</groupId>
7                 <artifactId>distribution-root</artifactId>
8                 <version>0.1.0-SNAPSHOT</version>
9         </parent>
10
11         <modelVersion>4.0.0</modelVersion>
12         <packaging>pom</packaging>
13         <groupId>org.onap.ccsdk.distribution</groupId>
14         <artifactId>distribution-dgbuilder-docker</artifactId>
15         <version>0.1.0-SNAPSHOT</version>
16
17         <name>Distribution - dgbuilder-docker</name>
18         <description>Creates docker container for dgbuilder</description>
19
20         <properties>
21                 <image.name>onap/ccsdk-dgbuilder-image</image.name>
22                 <ccsdk.project.version>${project.version}</ccsdk.project.version>
23         </properties>
24
25
26         <build>
27                 <plugins>
28
29
30             <plugin>
31                 <groupId>org.codehaus.groovy.maven</groupId>
32                 <artifactId>gmaven-plugin</artifactId>
33                 <executions>
34                     <execution>
35                         <phase>validate</phase>
36                         <goals>
37                             <goal>execute</goal>
38                         </goals>
39                         <configuration>
40                             <source>
41                                 println project.properties['ccsdk.project.version'];
42                                 def versionArray;
43                                 if ( project.properties['ccsdk.project.version'] != null ) {
44                                     versionArray = project.properties['ccsdk.project.version'].split('\\.');
45                                 }
46
47                                 if (project.properties['ccsdk.project.version'].endsWith("-SNAPSHOT"))
48                                 {
49                                     project.properties['project.docker.latesttag.version']=versionArray[0]  + '.' + versionArray[1] + "-STAGING-latest";
50                                 } else {
51                                     project.properties['project.docker.latesttag.version']=versionArray[0] + '.' + versionArray[1] + "-STAGING-latest";
52                                 }
53
54                                 println 'New Tag for docker:' +
55                                 project.properties['project.docker.latesttag.version'];
56                             </source>
57                         </configuration>
58                     </execution>
59                 </executions>
60             </plugin>
61                         <plugin>
62                                 <artifactId>maven-resources-plugin</artifactId>
63                                 <version>2.6</version>
64                                 <executions>
65                                         <execution>
66                                                 <id>copy-dockerfile</id>
67                                                 <goals>
68                                                         <goal>copy-resources</goal>
69                                                 </goals><!-- here the phase you need -->
70                                                 <phase>validate</phase>
71                                                 <configuration>
72                                                         <outputDirectory>${basedir}/target/docker-stage</outputDirectory>
73                                                         <resources>
74                                                                 <resource>
75                                                                         <directory>src/main/docker</directory>
76                                                                         <includes>
77                                                                                 <include>Dockerfile</include>
78                                                                         </includes>
79                                                                         <filtering>true</filtering>
80                                                                 </resource>
81                                                         </resources>
82                                                 </configuration>
83                                         </execution>
84                                 </executions>
85                         </plugin>
86
87                         <plugin>
88                                 <artifactId>exec-maven-plugin</artifactId>
89                                 <groupId>org.codehaus.mojo</groupId>
90                                 <version>1.5.0</version>
91                                 <executions>
92                                         <execution>
93                                                 <id>Make-stage-dir</id>
94                                                 <phase>generate-sources</phase>
95                                                 <goals>
96                                                         <goal>exec</goal>
97                                                 </goals>
98                                                 <configuration>
99                                                         <executable>/bin/mkdir</executable>
100                                                         <arguments>
101                                                         <argument>-p</argument>
102                                                         <argument>${basedir}/target/docker-stage/opt/onap/sdnc</argument>
103                                                         </arguments>
104                                                 </configuration>
105                                         </execution>
106                                         <execution>
107                                                 <id>Unzip dgbuilder</id>
108                                                 <phase>generate-sources</phase>
109                                                 <goals>
110                                                         <goal>exec</goal>
111                                                 </goals>
112                                                 <configuration>
113                                                         <executable>/usr/bin/unzip</executable>
114                                                         <arguments>
115                                                         <argument>-d</argument>
116                                                         <argument>${basedir}/target/docker-stage/opt/onap/sdnc</argument>
117                                                         <argument>../dgbuilder/target/*.zip</argument>
118                                                         </arguments>
119                                                 </configuration>
120                                         </execution>
121                                         <execution>
122                                                 <id>Copy dgbuilder</id>
123                                                 <phase>generate-sources</phase>
124                                                 <goals>
125                                                         <goal>exec</goal>
126                                                 </goals>
127                                                 <configuration>
128                                                         <executable>/bin/cp</executable>
129                                                         <arguments>
130                                                                 <argument>-r</argument>
131                                                                 <argument>../dgbuilder</argument>
132                                                                 <argument>${basedir}/target/docker-stage/opt/onap/sdnc</argument>
133                                                         </arguments>
134                                                 </configuration>
135                                         </execution>
136
137                                         <execution>
138                                                 <id>dgbuilder createReleaseDir</id>
139                                                 <phase>generate-sources</phase>
140                                                 <goals>
141                                                         <goal>exec</goal>
142                                                 </goals>
143                                                 <configuration>
144                                                         <executable>/bin/bash</executable>
145                                                         <arguments>
146                                                                 <argument>${basedir}/target/docker-stage/opt/onap/sdnc/dgbuilder/createReleaseDir.sh</argument>
147                                                                 <argument>1702</argument>
148                                                                 <argument>dguser</argument>
149                                                                 <argument>change_email_id@dgbuilder.com</argument>
150                                                         </arguments>
151                                                 </configuration>
152                                         </execution>
153
154                                         <execution>
155                                                 <id>change shell permissions</id>
156                                                 <phase>process-sources</phase>
157                                                 <goals>
158                                                         <goal>exec</goal>
159                                                 </goals>
160                                                 <configuration>
161                                                         <executable>/usr/bin/find</executable>
162                                                         <arguments>
163                                                                 <argument>${basedir}/target/docker-stage/opt/onap/sdnc</argument>
164                                                                 <argument>-name</argument>
165                                                                 <argument>*.sh</argument>
166                                                                 <argument>-exec</argument>
167                                                                 <argument>chmod</argument>
168                                                                 <argument>+x</argument>
169                                                                 <argument>{}</argument>
170                                                                 <argument>;</argument>
171                                                         </arguments>
172                                                 </configuration>
173                                         </execution>
174                                 </executions>
175                         </plugin>
176                 </plugins>
177     </build>
178     <profiles>
179         <profile>
180             <id>docker</id>
181             <build>
182                 <plugins>
183                         <plugin>
184                                 <groupId>io.fabric8</groupId>
185                                 <artifactId>docker-maven-plugin</artifactId>
186                                 <version>0.16.5</version>
187                                 <inherited>false</inherited>
188                                 <configuration>
189
190                                         <images>
191                                                 <image>
192                                                         <name>${image.name}</name>
193                                                         <build>
194                                                                 <cleanup>try</cleanup>
195                                                                 <dockerFileDir>${basedir}/target/docker-stage</dockerFileDir>
196                                                                 <dockerFile>${basedir}/target/docker-stage/Dockerfile</dockerFile>
197                                                                 <tags>
198                                                                         <tag>${project.version}</tag>
199                                                                         <tag>${project.version}-STAGING-${maven.build.timestamp}</tag>
200                                                                         <tag>${project.docker.latesttag.version}</tag>
201                                                                 </tags>
202                                                         </build>
203                                                 </image>
204                                         </images>
205                                 </configuration>
206                                 <executions>
207                                         <execution>
208                                                 <id>generate-images</id>
209                                                 <phase>package</phase>
210                                                 <goals>
211                                                         <goal>build</goal>
212                                                 </goals>
213                                         </execution>
214
215                                         <execution>
216                                                 <id>push-images</id>
217                                                 <phase>deploy</phase>
218                                                 <goals>
219                                                         <goal>build</goal>
220                                                         <goal>push</goal>
221                                                 </goals>
222                                         </execution>
223                                 </executions>
224                         </plugin>
225                 </plugins>
226         </build>
227         </profile>
228     </profiles>
229         <organization>
230                 <name>ONAP</name>
231         </organization>
232 </project>