[SDNC-5] Docker tag
[sdnc/oam.git] / installation / ubuntu / 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-ubuntu</artifactId>
15         <version>1.1.0-SNAPSHOT</version>
16
17         <name>Installation - ubuntu</name>
18         <description>Creates base ubuntu Docker container</description>
19
20         <properties>
21                 <image.name>openecomp/ubuntu-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}</tag>
81                                                                         <tag>${project.version}-STAGING-${maven.build.timestamp}</tag>
82                                                                         <tag>${project.docker.latesttag.version}</tag>
83                                                                 </tags>
84                                                         </build>
85                                                 </image>
86                                         </images>
87                                 </configuration>
88                                 <executions>
89                                         <execution>
90                                                 <id>generate-images</id>
91                                                 <phase>generate-sources</phase>
92                                                 <goals>
93                                                         <goal>build</goal>
94                                                 </goals>
95                                         </execution>
96
97                                         <execution>
98                                                 <id>push-images</id>
99                                                 <phase>deploy</phase>
100                                                 <goals>
101                                                         <goal>build</goal>
102                                                         <goal>push</goal>
103                                                 </goals>
104                                         </execution>
105                                 </executions>
106                         </plugin>
107
108                         <plugin>
109                                 <artifactId>maven-resources-plugin</artifactId>
110                                 <version>2.6</version>
111                                 <executions>
112                                         <execution>
113                                                 <id>copy-dockerfile</id>
114                                                 <goals>
115                                                         <goal>copy-resources</goal>
116                                                 </goals><!-- here the phase you need -->
117                                                 <phase>validate</phase>
118                                                 <configuration>
119                                                         <outputDirectory>${basedir}/target/docker-stage</outputDirectory>
120                                                         <resources>
121                                                                 <resource>
122                                                                         <directory>src/main/docker</directory>
123                                                                         <includes>
124                                                                                 <include>Dockerfile</include>
125                                                                         </includes>
126                                                                         <filtering>true</filtering>
127                                                                 </resource>
128                                                         </resources>
129                                                 </configuration>
130                                         </execution>
131                                 </executions>
132                         </plugin>
133                 </plugins>
134
135         </build>
136         <organization>
137                 <name>openECOMP</name>
138         </organization>
139 </project>