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