blob: 54340792d8b93d0b1946df0d3b4c1a57b4bba856 [file] [log] [blame]
Jorge Hernandez638480e2019-02-07 15:58:58 -06001<!--
2 ============LICENSE_START=======================================================
3 ONAP
4 ================================================================================
jhh927533c2020-02-16 19:49:42 -06005 Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
Bruno Sakoto0945c4f2020-01-07 17:48:00 -05006 Modifications Copyright (C) 2019-2020 Bell Canada.
Jorge Hernandez638480e2019-02-07 15:58:58 -06007 ================================================================================
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"
23 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
24
25 <modelVersion>4.0.0</modelVersion>
Jorge Hernandez638480e2019-02-07 15:58:58 -060026 <parent>
27 <groupId>org.onap.policy.drools-applications.controlloop.packages</groupId>
Ram Krishna Vermad0cbee12020-02-07 13:03:27 -050028 <artifactId>drools-applications-packages</artifactId>
Taka Cho89d7bfc2020-10-08 08:34:34 -040029 <version>1.7.3-SNAPSHOT</version>
Jorge Hernandez638480e2019-02-07 15:58:58 -060030 </parent>
Jorge Hernandez638480e2019-02-07 15:58:58 -060031 <artifactId>docker-controlloop</artifactId>
32 <packaging>pom</packaging>
33
34 <name>docker-controlloop</name>
35 <description>ONAP Policy Control Loop PDP-D Docker Build</description>
36
Rashmi Pujar19cade12019-06-03 17:14:45 -040037 <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_APP_CL>${project.version}</docker.buildArg.BUILD_VERSION_APP_CL>
48 </properties>
49
Jorge Hernandez638480e2019-02-07 15:58:58 -060050 <build>
Rashmi Pujar19cade12019-06-03 17:14:45 -040051 <finalName>${project.artifactId}-${project.version}</finalName>
Jorge Hernandez638480e2019-02-07 15:58:58 -060052 <plugins>
53 <plugin>
Rashmi Pujar19cade12019-06-03 17:14:45 -040054 <groupId>org.codehaus.groovy.maven</groupId>
55 <artifactId>gmaven-plugin</artifactId>
56 <version>1.0</version>
Jorge Hernandez638480e2019-02-07 15:58:58 -060057 <executions>
58 <execution>
Rashmi Pujar19cade12019-06-03 17:14:45 -040059 <phase>validate</phase>
Jorge Hernandez638480e2019-02-07 15:58:58 -060060 <goals>
Rashmi Pujar19cade12019-06-03 17:14:45 -040061 <goal>execute</goal>
Jorge Hernandez638480e2019-02-07 15:58:58 -060062 </goals>
63 <configuration>
Rashmi Pujar19cade12019-06-03 17:14:45 -040064 <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: ' + properties['project.docker.latest.minmax.tag.version']
77 }
78 </source>
Jorge Hernandez638480e2019-02-07 15:58:58 -060079 </configuration>
80 </execution>
81 </executions>
82 </plugin>
Bruno Sakoto0945c4f2020-01-07 17:48:00 -050083 <!--fabric8.io docker-maven-plugin does not support ARG usage in the FROM statement of Dockerfile
84 even though docker supports it: https://github.com/fabric8io/docker-maven-plugin/issues/859.
85 As a workaround we shall use maven-antrun-plugin to copy the Dockerfile and apply filters to
86 replace the parameterized base-image version. The fabric8.io docker-maven-plugin shall use this filtered file
87 to build the image. After the image is built we perform a cleanup to remove the filtered file.-->
88 <plugin>
89 <artifactId>maven-antrun-plugin</artifactId>
90 <executions>
91 <execution>
92 <id>update-parameterized-dockerfile</id>
93 <phase>initialize</phase>
94 <goals>
95 <goal>run</goal>
96 </goals>
97 <configuration>
98 <tasks>
99 <copy file="src/main/docker/Dockerfile" toFile="${project.build.directory}/docker-tmp/Dockerfile">
100 <filterset>
101 <filter token="version.policy.drools-pdp" value="${version.policy.drools-pdp}"/>
102 </filterset>
103 </copy>
104 </tasks>
105 </configuration>
106 </execution>
107 </executions>
108 </plugin>
Jorge Hernandez638480e2019-02-07 15:58:58 -0600109 <plugin>
Rashmi Pujar19cade12019-06-03 17:14:45 -0400110 <groupId>io.fabric8</groupId>
111 <artifactId>docker-maven-plugin</artifactId>
Jorge Hernandez638480e2019-02-07 15:58:58 -0600112 <configuration>
Rashmi Pujar19cade12019-06-03 17:14:45 -0400113 <verbose>true</verbose>
114 <apiVersion>1.23</apiVersion>
115 <pullRegistry>${docker.pull.registry}</pullRegistry>
116 <pushRegistry>${docker.push.registry}</pushRegistry>
117 <images>
118 <image>
119 <name>onap/policy-pdpd-cl</name>
120 <build>
121 <cleanup>try</cleanup>
Bruno Sakoto0945c4f2020-01-07 17:48:00 -0500122 <contextDir>${project.build.directory}/docker-tmp</contextDir>
Rashmi Pujar19cade12019-06-03 17:14:45 -0400123 <dockerFile>Dockerfile</dockerFile>
124 <tags>
125 <tag>${project.version}</tag>
126 <tag>${project.version}-${maven.build.timestamp}</tag>
127 <tag>${project.docker.latest.minmax.tag.version}</tag>
128 </tags>
129 <assembly>
130 <descriptor>${project.basedir}/src/main/assembly/assembly.xml</descriptor>
131 <user>policy:policy:policy</user>
132 </assembly>
133 </build>
134 </image>
135 </images>
136 </configuration>
137 <executions>
138 <execution>
139 <id>clean-images</id>
140 <phase>pre-clean</phase>
141 <goals>
142 <goal>remove</goal>
143 </goals>
144 <configuration>
145 <removeAll>true</removeAll>
146 </configuration>
147 </execution>
148 <execution>
149 <id>generate-images</id>
150 <phase>generate-sources</phase>
151 <goals>
152 <goal>build</goal>
153 </goals>
154 </execution>
155 <execution>
156 <id>push-images</id>
157 <phase>deploy</phase>
158 <goals>
159 <goal>build</goal>
160 <goal>push</goal>
161 </goals>
Rashmi Pujar19cade12019-06-03 17:14:45 -0400162 </execution>
163 </executions>
164 </plugin>
165 <plugin>
166 <groupId>org.apache.maven.plugins</groupId>
167 <artifactId>maven-deploy-plugin</artifactId>
168 <configuration>
169 <skip>true</skip>
Jorge Hernandez638480e2019-02-07 15:58:58 -0600170 </configuration>
171 </plugin>
Jorge Hernandez638480e2019-02-07 15:58:58 -0600172 </plugins>
173 </build>
Rashmi Pujar19cade12019-06-03 17:14:45 -0400174 <dependencies>
175 <dependency>
176 <groupId>${project.groupId}</groupId>
177 <artifactId>apps-controlloop</artifactId>
178 <version>${project.version}</version>
179 <type>zip</type>
180 </dependency>
181 </dependencies>
Jorge Hernandez638480e2019-02-07 15:58:58 -0600182</project>