Merge "Miscellaneous code clean up"
[policy/drools-pdp.git] / packages / docker / pom.xml
1 <!--
2   ============LICENSE_START=======================================================
3   ONAP Policy Engine - Docker files
4   ================================================================================
5   Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
6   Modifications Copyright (C) 2019 Bell Canada.
7   ================================================================================
8   Licensed under the Apache License, Version 2.0 (the "License");
9   you may not use this file except in compliance with the License.
10   You may obtain a copy of the License at
11
12          http://www.apache.org/licenses/LICENSE-2.0
13
14   Unless required by applicable law or agreed to in writing, software
15   distributed under the License is distributed on an "AS IS" BASIS,
16   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17   See the License for the specific language governing permissions and
18   limitations under the License.
19   ============LICENSE_END=========================================================
20   -->
21
22 <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">
23
24     <modelVersion>4.0.0</modelVersion>
25
26     <parent>
27         <groupId>org.onap.policy.drools-pdp</groupId>
28         <artifactId>packages</artifactId>
29         <version>1.6.0-SNAPSHOT</version>
30     </parent>
31
32     <artifactId>docker</artifactId>
33     <packaging>pom</packaging>
34     <name>Policy Drools PDP - Docker build</name>
35     <description>ONAP Policy Drools PDP Docker Build</description>
36
37     <properties>
38         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
39         <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
40         <dist.project.version>${project.version}</dist.project.version>
41         <docker.skip>false</docker.skip>
42         <docker.skip.build>false</docker.skip.build>
43         <docker.skip.push>false</docker.skip.push>
44         <docker.pull.registry>nexus3.onap.org:10001</docker.pull.registry>
45         <docker.push.registry>nexus3.onap.org:10003</docker.push.registry>
46         <maven.build.timestamp.format>yyyyMMdd'T'HHmm</maven.build.timestamp.format>
47         <docker.buildArg.BUILD_VERSION_DROOLS>${project.version}</docker.buildArg.BUILD_VERSION_DROOLS>
48     </properties>
49
50     <build>
51         <finalName>${project.artifactId}-${project.version}</finalName>
52         <plugins>
53             <plugin>
54                 <groupId>org.codehaus.groovy.maven</groupId>
55                 <artifactId>gmaven-plugin</artifactId>
56                 <version>1.0</version>
57                 <executions>
58                     <execution>
59                         <phase>validate</phase>
60                         <goals>
61                             <goal>execute</goal>
62                         </goals>
63                         <configuration>
64                             <source>
65                                 println 'Project version: ' + project.properties['dist.project.version']
66                                 if (project.properties['dist.project.version'] != null) {
67                                     def versionArray = project.properties['dist.project.version'].split('-')
68                                     def minMaxVersionArray = versionArray[0].tokenize('.')
69                                     if (project.properties['dist.project.version'].endsWith("-SNAPSHOT")) {
70                                         project.properties['project.docker.latest.minmax.tag.version'] =
71                                           minMaxVersionArray[0] + "." + minMaxVersionArray[1] + "-SNAPSHOT-latest"
72                                     } else {
73                                         project.properties['project.docker.latest.minmax.tag.version'] =
74                                           minMaxVersionArray[0] + "." + minMaxVersionArray[1] + "-STAGING-latest"
75                                     }
76                                     println 'New tag for docker: ' + project.properties['project.docker.latest.minmax.tag.version']
77                                 }
78                             </source>
79                         </configuration>
80                     </execution>
81                 </executions>
82             </plugin>
83             <plugin>
84                 <groupId>io.fabric8</groupId>
85                 <artifactId>docker-maven-plugin</artifactId>
86                 <configuration>
87                     <verbose>true</verbose>
88                     <apiVersion>1.23</apiVersion>
89                     <pullRegistry>${docker.pull.registry}</pullRegistry>
90                     <pushRegistry>${docker.push.registry}</pushRegistry>
91                     <images>
92                         <image>
93                             <name>onap/policy-drools</name>
94                             <build>
95                                 <cleanup>try</cleanup>
96                                 <dockerFile>Dockerfile</dockerFile>
97                                 <tags>
98                                     <tag>${project.version}</tag>
99                                     <tag>${project.version}-${maven.build.timestamp}</tag>
100                                     <tag>${project.docker.latest.minmax.tag.version}</tag>
101                                 </tags>
102                                 <assembly>
103                                     <inline>
104                                         <dependencySets>
105                                             <dependencySet>
106                                                 <includes>
107                                                     <include>org.onap.policy.drools-pdp:install-drools</include>
108                                                 </includes>
109                                                 <outputDirectory>.</outputDirectory>
110                                                 <outputFileNameMapping>install-drools.zip</outputFileNameMapping>
111                                             </dependencySet>
112                                         </dependencySets>
113                                     </inline>
114                                 </assembly>
115                             </build>
116                         </image>
117                     </images>
118                 </configuration>
119                 <executions>
120                     <execution>
121                         <id>clean-images</id>
122                         <phase>pre-clean</phase>
123                         <goals>
124                             <goal>remove</goal>
125                         </goals>
126                         <configuration>
127                             <removeAll>true</removeAll>
128                         </configuration>
129                     </execution>
130                     <execution>
131                         <id>generate-images</id>
132                         <phase>generate-sources</phase>
133                         <goals>
134                             <goal>build</goal>
135                         </goals>
136                     </execution>
137                     <execution>
138                         <id>push-images</id>
139                         <phase>deploy</phase>
140                         <goals>
141                             <goal>build</goal>
142                             <goal>push</goal>
143                         </goals>
144                         <configuration>
145                             <image>onap/policy-drools</image>
146                         </configuration>
147                     </execution>
148                 </executions>
149             </plugin>
150             <plugin>
151                 <groupId>org.apache.maven.plugins</groupId>
152                 <artifactId>maven-deploy-plugin</artifactId>
153                 <configuration>
154                     <skip>true</skip>
155                 </configuration>
156             </plugin>
157         </plugins>
158     </build>
159     <dependencies>
160         <dependency>
161             <groupId>${project.groupId}</groupId>
162             <artifactId>install-drools</artifactId>
163             <version>${project.version}</version>
164             <type>zip</type>
165         </dependency>
166     </dependencies>
167 </project>