3dfbc0e79acd8366f7e81d8cb25aa1fc3f689cf4
[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" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3     <modelVersion>4.0.0</modelVersion>
4
5     <parent>
6         <groupId>org.onap.ccsdk.distribution</groupId>
7         <artifactId>distribution-root</artifactId>
8         <version>1.1.1-SNAPSHOT</version>
9     </parent>
10
11     <groupId>org.onap.ccsdk.distribution</groupId>
12     <artifactId>distribution-dgbuilder-docker</artifactId>
13     <packaging>pom</packaging>
14
15     <name>ccsdk-distribution :: dgbuilder-docker</name>
16     <description>Creates docker container for dgbuilder</description>
17     <organization>
18         <name>ONAP</name>
19     </organization>
20
21     <properties>
22         <image.name>onap/ccsdk-dgbuilder-image</image.name>
23         <uniquedockertag>${env.UNIQUE_DOCKER_TAG}</uniquedockertag>
24     </properties>
25
26     <build>
27         <plugins>
28
29             <plugin>
30                 <groupId>org.codehaus.groovy.maven</groupId>
31                 <artifactId>gmaven-plugin</artifactId>
32                 <version>1.0</version>
33                 <executions>
34                     <execution>
35                         <phase>validate</phase>
36                         <goals>
37                             <goal>execute</goal>
38                         </goals>
39                         <configuration>
40                             <source>${basedir}/../src/main/scripts/TagSnapshotVersion.groovy</source>
41                         </configuration>
42                     </execution>
43                 </executions>
44             </plugin>
45             <plugin>
46                 <artifactId>maven-resources-plugin</artifactId>
47                 <version>2.6</version>
48                 <executions>
49                     <execution>
50                         <id>copy-dockerfile</id>
51                         <goals>
52                             <goal>copy-resources</goal>
53                         </goals><!-- here the phase you need -->
54                         <phase>validate</phase>
55                         <configuration>
56                             <outputDirectory>${basedir}/target/docker-stage</outputDirectory>
57                             <resources>
58                                 <resource>
59                                     <directory>src/main/docker</directory>
60                                     <includes>
61                                         <include>Dockerfile</include>
62                                     </includes>
63                                     <filtering>true</filtering>
64                                 </resource>
65                             </resources>
66                         </configuration>
67                     </execution>
68                 </executions>
69             </plugin>
70
71             <plugin>
72                 <groupId>org.codehaus.mojo</groupId>
73                 <artifactId>exec-maven-plugin</artifactId>
74                 <version>1.5.0</version>
75                 <executions>
76                     <execution>
77                         <id>Make-stage-dir</id>
78                         <phase>generate-sources</phase>
79                         <goals>
80                             <goal>exec</goal>
81                         </goals>
82                         <configuration>
83                             <executable>/bin/mkdir</executable>
84                             <arguments>
85                                 <argument>-p</argument>
86                                 <argument>${basedir}/target/docker-stage/opt/onap/ccsdk</argument>
87                             </arguments>
88                         </configuration>
89                     </execution>
90                     <execution>
91                         <id>Unzip dgbuilder</id>
92                         <phase>generate-sources</phase>
93                         <goals>
94                             <goal>exec</goal>
95                         </goals>
96                         <configuration>
97                             <executable>/usr/bin/unzip</executable>
98                             <arguments>
99                                 <argument>-d</argument>
100                                 <argument>${basedir}/target/docker-stage/opt/onap/ccsdk</argument>
101                                 <argument>../dgbuilder/target/*.zip</argument>
102                             </arguments>
103                         </configuration>
104                     </execution>
105                     <execution>
106                         <id>Copy dgbuilder</id>
107                         <phase>generate-sources</phase>
108                         <goals>
109                             <goal>exec</goal>
110                         </goals>
111                         <configuration>
112                             <executable>/bin/cp</executable>
113                             <arguments>
114                                 <argument>-r</argument>
115                                 <argument>../dgbuilder</argument>
116                                 <argument>${basedir}/target/docker-stage/opt/onap/ccsdk</argument>
117                             </arguments>
118                         </configuration>
119                     </execution>
120
121                     <execution>
122                         <id>dgbuilder createReleaseDir</id>
123                         <phase>generate-sources</phase>
124                         <goals>
125                             <goal>exec</goal>
126                         </goals>
127                         <configuration>
128                             <executable>/bin/bash</executable>
129                             <arguments>
130                                 <argument>${basedir}/target/docker-stage/opt/onap/ccsdk/dgbuilder/createReleaseDir.sh</argument>
131                                 <argument>1702</argument>
132                                 <argument>dguser</argument>
133                                 <argument>change_email_id@dgbuilder.com</argument>
134                             </arguments>
135                         </configuration>
136                     </execution>
137
138                     <execution>
139                         <id>change shell permissions</id>
140                         <phase>process-sources</phase>
141                         <goals>
142                             <goal>exec</goal>
143                         </goals>
144                         <configuration>
145                             <executable>/usr/bin/find</executable>
146                             <arguments>
147                                 <argument>${basedir}/target/docker-stage/opt/onap/ccsdk</argument>
148                                 <argument>-name</argument>
149                                 <argument>*.sh</argument>
150                                 <argument>-exec</argument>
151                                 <argument>chmod</argument>
152                                 <argument>+x</argument>
153                                 <argument>{}</argument>
154                                 <argument>;</argument>
155                             </arguments>
156                         </configuration>
157                     </execution>
158                 </executions>
159             </plugin>
160         </plugins>
161     </build>
162
163     <profiles>
164         <profile>
165             <id>docker</id>
166             <build>
167                 <plugins>
168                     <plugin>
169                         <groupId>io.fabric8</groupId>
170                         <artifactId>docker-maven-plugin</artifactId>
171                         <version>0.34.0</version>
172                         <inherited>false</inherited>
173                         <configuration>
174                             <images>
175                                 <image>
176                                     <name>${image.name}</name>
177                                     <build>
178                                         <cleanup>try</cleanup>
179                                         <contextDir>${basedir}/target/docker-stage</contextDir>
180                                         <dockerFile>Dockerfile</dockerFile>
181                                         <tags>
182                                             <tag>${project.docker.latestminortag.snapshot.version}</tag>
183                                             <tag>${project.docker.latestfulltag.snapshot.version}</tag>
184                                             <tag>${project.docker.latesttagtimestamp.snapshot.version}</tag>
185                                                                                         <tag>${project.docker.uniquedockertag.snapshot.version}</tag>
186                                         </tags>
187                                     </build>
188                                 </image>
189                             </images>
190                             <verbose>${docker.verbose}</verbose>
191                             <!-- Hardocding skipPush to false, as during verification CSIT currently pulling docker image from nexus -->
192                             <!-- <skipPush>${docker.skip.push}</skipPush> -->
193                             <skipPush>false</skipPush>
194                         </configuration>
195                         <executions>
196                             <execution>
197                                 <id>build-push-images</id>
198                                 <goals>
199                                     <goal>build</goal>
200                                     <goal>push</goal>
201                                 </goals>
202                             </execution>
203                         </executions>
204                     </plugin>
205                 </plugins>
206             </build>
207         </profile>
208     </profiles>
209 </project>