Allow setting external dockerfile for simulator
[policy/models.git] / models-sim / packages / models-simulator-docker / pom.xml
1 <!--
2   ============LICENSE_START=======================================================
3    Copyright (C) 2020 Bell Canada.
4    Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
5    Modifications Copyright (C) 2022 Nordix Foundation.
6   ================================================================================
7   Licensed under the Apache License, Version 2.0 (the "License");
8   you may not use this file except in compliance with the License.
9   You may obtain a copy of the License at
10
11        http://www.apache.org/licenses/LICENSE-2.0
12
13   Unless required by applicable law or agreed to in writing, software
14   distributed under the License is distributed on an "AS IS" BASIS,
15   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   See the License for the specific language governing permissions and
17   limitations under the License.
18
19   SPDX-License-Identifier: Apache-2.0
20   ============LICENSE_END=========================================================
21 -->
22
23 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
24   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
25     <modelVersion>4.0.0</modelVersion>
26     <parent>
27         <groupId>org.onap.policy.models.sim</groupId>
28         <artifactId>models-sim-packages</artifactId>
29         <version>2.7.0-SNAPSHOT</version>
30     </parent>
31
32     <artifactId>models-simulator-docker</artifactId>
33     <packaging>pom</packaging>
34
35     <name>${project.artifactId}</name>
36     <description>The module for creating docker images of Simulators component.</description>
37
38     <properties>
39         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
40         <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
41         <dist.project.version>${project.version}</dist.project.version>
42         <docker.skip>false</docker.skip>
43         <docker.skip.build>false</docker.skip.build>
44         <docker.skip.push>false</docker.skip.push>
45         <docker.pull.registry>nexus3.onap.org:10001</docker.pull.registry>
46         <docker.push.registry>nexus3.onap.org:10003</docker.push.registry>
47         <docker.contextDir>${project.basedir}/src/main/docker</docker.contextDir>
48         <maven.build.timestamp.format>yyyyMMdd'T'HHmm</maven.build.timestamp.format>
49         <!-- There is no code in this sub-module, only holds interfaces. So skip sonar. -->
50         <sonar.skip>true</sonar.skip>
51     </properties>
52
53     <build>
54         <finalName>${project.artifactId}-${project.version}</finalName>
55         <plugins>
56             <plugin>
57                 <groupId>org.codehaus.gmaven</groupId>
58                 <artifactId>groovy-maven-plugin</artifactId>
59                 <version>2.1.1</version>
60                 <executions>
61                     <execution>
62                         <phase>validate</phase>
63                         <goals>
64                             <goal>execute</goal>
65                         </goals>
66                         <configuration>
67                             <source>https://github.com/onap/policy-docker/raw/master/utils/groovy/docker-tag.groovy</source>
68                         </configuration>
69                     </execution>
70                 </executions>
71             </plugin>
72
73             <plugin>
74                 <groupId>io.github.git-commit-id</groupId>
75                 <artifactId>git-commit-id-maven-plugin</artifactId>
76                 <version>5.0.0</version>
77                 <executions>
78                     <execution>
79                         <id>get-the-git-infos</id>
80                         <goals>
81                             <goal>revision</goal>
82                         </goals>
83                         <phase>initialize</phase>
84                     </execution>
85                 </executions>
86                 <configuration>
87                     <skipPoms>false</skipPoms>
88                     <generateGitPropertiesFile>true</generateGitPropertiesFile>
89                     <includeOnlyProperties>
90                         <includeOnlyProperty>^git.build.(time|version)$</includeOnlyProperty>
91                         <includeOnlyProperty>^git.commit.id.abbrev$</includeOnlyProperty>
92                     </includeOnlyProperties>
93                     <commitIdGenerationMode>full</commitIdGenerationMode>
94                 </configuration>
95             </plugin>
96
97             <plugin>
98                 <groupId>io.fabric8</groupId>
99                 <artifactId>docker-maven-plugin</artifactId>
100
101                 <configuration>
102                     <verbose>true</verbose>
103                     <apiVersion>1.23</apiVersion>
104                     <pullRegistry>${docker.pull.registry}</pullRegistry>
105                     <pushRegistry>${docker.push.registry}</pushRegistry>
106
107                     <images>
108                         <image>
109                             <name>onap/policy-models-simulator</name>
110                             <build>
111                                 <cleanup>try</cleanup>
112                                 <dockerFile>${dockerFile}</dockerFile>
113                                 <contextDir>${docker.contextDir}</contextDir>
114                                 <tags>
115                                     <tag>${project.version}</tag>
116                                     <tag>${project.version}-${maven.build.timestamp}</tag>
117                                     <tag>${project.docker.latest.minmax.tag.version}</tag>
118                                 </tags>
119                                 <assembly>
120                                     <inline>
121                                         <dependencySets>
122                                             <dependencySet>
123                                                 <includes>
124                                                     <include>org.onap.policy.models.sim:models-simulator-tarball</include>
125                                                 </includes>
126                                                 <outputDirectory>/lib</outputDirectory>
127                                                 <outputFileNameMapping>models-simulator.tar.gz</outputFileNameMapping>
128                                             </dependencySet>
129                                         </dependencySets>
130                                     </inline>
131                                 </assembly>
132                             </build>
133                         </image>
134                     </images>
135                 </configuration>
136
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
149                     <execution>
150                         <id>generate-images</id>
151                         <phase>generate-sources</phase>
152                         <goals>
153                             <goal>build</goal>
154                         </goals>
155                     </execution>
156
157                     <execution>
158                         <id>push-images</id>
159                         <phase>deploy</phase>
160                         <goals>
161                             <goal>build</goal>
162                             <goal>push</goal>
163                         </goals>
164                         <configuration>
165                             <image>onap/policy-models-simulator</image>
166                         </configuration>
167                     </execution>
168                 </executions>
169             </plugin>
170
171             <plugin>
172                 <groupId>org.apache.maven.plugins</groupId>
173                 <artifactId>maven-deploy-plugin</artifactId>
174                 <configuration>
175                     <skip>true</skip>
176                 </configuration>
177             </plugin>
178         </plugins>
179     </build>
180
181     <dependencies>
182         <dependency>
183             <groupId>org.onap.policy.models.sim</groupId>
184             <artifactId>models-simulator-tarball</artifactId>
185             <version>${project.version}</version>
186             <classifier>tarball</classifier>
187             <type>tar.gz</type>
188         </dependency>
189     </dependencies>
190 </project>