reduce sdnc-ansible-server image footprint
[sdnc/oam.git] / installation / ansible-server / 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/maven-v4_0_0.xsd">
3
4     <parent>
5         <groupId>org.onap.ccsdk.parent</groupId>
6         <artifactId>odlparent-lite</artifactId>
7         <version>1.2.1-SNAPSHOT</version>
8     </parent>
9     <modelVersion>4.0.0</modelVersion>
10     <packaging>pom</packaging>
11     <groupId>org.onap.sdnc.oam</groupId>
12     <artifactId>installation-ansible-server</artifactId>
13     <version>1.5.0-SNAPSHOT</version>
14
15     <name>sdnc-oam :: installation :: ${project.artifactId}</name>
16     <description>Creates ansible-server Docker container</description>
17
18     <properties>
19         <image.name>onap/sdnc-ansible-server-image</image.name>
20         <sdnc.project.version>${project.version}</sdnc.project.version>
21         <ccsdk.docker.version>0.4-STAGING-latest</ccsdk.docker.version>
22         <docker.buildArg.https_proxy>${https_proxy}</docker.buildArg.https_proxy>
23         <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format>
24     </properties>
25
26
27     <build>
28         <plugins>
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 = project.properties['sdnc.project.version'].split('\\.');
44                                 }
45
46                                 if (project.properties['sdnc.project.version'].endsWith("-SNAPSHOT"))
47                                 {
48                                 project.properties['project.docker.latesttag.version']=versionArray[0] + '.' + versionArray[1] + "-STAGING-latest";
49                                 } else {
50                                 project.properties['project.docker.latesttag.version']=versionArray[0] + '.' + versionArray[1] + "-STAGING-latest";
51                                 }
52
53                                 println 'New Tag for docker:' + project.properties['project.docker.latesttag.version'];
54                             </source>
55                         </configuration>
56                     </execution>
57                 </executions>
58             </plugin>
59
60             <plugin>
61                 <artifactId>maven-resources-plugin</artifactId>
62                 <version>2.6</version>
63                 <executions>
64                     <execution>
65                         <id>copy-files</id>
66                         <goals>
67                             <goal>copy-resources</goal>
68                         </goals><!-- here the phase you need -->
69                         <phase>validate</phase>
70                         <configuration>
71                             <outputDirectory>${basedir}/target/docker-stage</outputDirectory>
72                             <resources>
73                                 <resource>
74                                     <directory>src/main</directory>
75                                     <includes>
76                                         <include>**/*</include>
77                                     </includes>
78                                     <filtering>false</filtering>
79                                 </resource>
80                             </resources>
81                         </configuration>
82                     </execution>
83                 </executions>
84             </plugin>
85         </plugins>
86     </build>
87
88     <profiles>
89         <profile>
90             <id>docker</id>
91             <build>
92                 <plugins>
93                     <plugin>
94                         <groupId>io.fabric8</groupId>
95                         <artifactId>docker-maven-plugin</artifactId>
96                         <version>0.16.5</version>
97                         <inherited>false</inherited>
98                         <configuration>
99                             <images>
100                                 <image>
101                                     <name>${image.name}</name>
102                                     <build>
103                                         <cleanup>try</cleanup>
104                                         <dockerFileDir>${basedir}/target/docker-stage</dockerFileDir>
105                                         <dockerFile>${basedir}/target/docker-stage/Dockerfile</dockerFile>
106                                         <tags>
107                                             <tag>${project.version}</tag>
108                                             <tag>${project.version}-STAGING-${maven.build.timestamp}</tag>
109                                             <tag>${project.docker.latesttag.version}</tag>
110                                         </tags>
111                                     </build>
112                                 </image>
113                             </images>
114                         </configuration>
115                         <executions>
116                             <execution>
117                                 <id>generate-images</id>
118                                 <phase>package</phase>
119                                 <goals>
120                                     <goal>build</goal>
121                                 </goals>
122                             </execution>
123
124                             <execution>
125                                 <id>push-images</id>
126                                 <phase>deploy</phase>
127                                 <goals>
128                                     <goal>build</goal>
129                                     <goal>push</goal>
130                                 </goals>
131                             </execution>
132                         </executions>
133                     </plugin>
134                 </plugins>
135             </build>
136         </profile>
137     </profiles>
138     <organization>
139         <name>ONAP</name>
140     </organization>
141 </project>