Modified configuration of docker build
authorTomasz Golabek <tomasz.golabek@nokia.com>
Thu, 13 Feb 2020 11:07:35 +0000 (12:07 +0100)
committerTomasz Golabek <tomasz.golabek@nokia.com>
Thu, 13 Feb 2020 11:18:27 +0000 (12:18 +0100)
Configuration of docker profile taken from hv-ves

Issue-ID: AAF-997
Signed-off-by: Tomasz Golabek <tomasz.golabek@nokia.com>
Change-Id: I37311477214b2f50b516fa64e951ae37d24137ce

certService/pom.xml

index ea919f8..6ee630a 100644 (file)
         <springdoc-openapi-ui.version>1.2.21</springdoc-openapi-ui.version>
         <bouncycastle.version>1.60</bouncycastle.version>
         <docker-maven-plugin.version>0.33.0</docker-maven-plugin.version>
-        <docker.tag>${project.version}</docker.tag>
         <springdoc-openapi-maven-plugin.apiDocsUrl>http://localhost:8080/v3/api-docs
         </springdoc-openapi-maven-plugin.apiDocsUrl>
-        <docker-maven-plugin.image-name>onap/${project.artifactId}</docker-maven-plugin.image-name>
         <springdoc-openapi-maven-plugin.version>0.2</springdoc-openapi-maven-plugin.version>
         <gson.version>2.8.6</gson.version>
+
+        <!-- Docker -->
+        <skipDockerPush>true</skipDockerPush>
+        <maven.build.timestamp.format>yyyyMMdd'T'HHmmss</maven.build.timestamp.format>
+        <docker-image.registry>${onap.nexus.dockerregistry.daily}</docker-image.registry>
+        <docker-image.namespace>onap</docker-image.namespace>
+        <docker-image.name>${project.groupId}.${project.artifactId}</docker-image.name>
+        <docker-image.latest>${project.version}</docker-image.latest>
+        <docker.http_proxy/>
+
     </properties>
 
     <dependencyManagement>
             <activation>
                 <activeByDefault>false</activeByDefault>
             </activation>
+            <properties>
+                <os.detected.name>linux</os.detected.name>
+                <os.detected.arch>x86_64</os.detected.arch>
+                <os.detected.classifier>${os.detected.name}-${os.detected.arch}</os.detected.classifier>
+            </properties>
             <build>
                 <plugins>
                     <plugin>
                         <groupId>io.fabric8</groupId>
                         <artifactId>docker-maven-plugin</artifactId>
-                        <version>${docker-maven-plugin.version}</version>
+                        <version>0.26.0</version>
                         <executions>
                             <execution>
-                                <id>clean-images</id>
-                                <phase>pre-clean</phase>
-                                <goals>
-                                    <goal>remove</goal>
-                                </goals>
-                                <configuration>
-                                    <removeAll>true</removeAll>
-                                    <image>${docker-maven-plugin.image-name}</image>
-                                </configuration>
-                            </execution>
-                            <execution>
-                                <id>generate-images</id>
-                                <phase>install</phase>
+                                <id>docker-build-image</id>
+                                <phase>package</phase>
                                 <goals>
                                     <goal>build</goal>
                                 </goals>
                             </execution>
-<!--                            It has to be published on nexus firstly to uncomment integration tests-->
-<!--                            <execution>-->
-<!--                                <id>start</id>-->
-<!--                                <phase>pre-integration-test</phase>-->
-<!--                                <goals>-->
-<!--                                    <goal>start</goal>-->
-<!--                                </goals>-->
-<!--                            </execution>-->
-<!--                            <execution>-->
-<!--                                <id>stop</id>-->
-<!--                                <phase>post-integration-test</phase>-->
-<!--                                <goals>-->
-<!--                                    <goal>stop</goal>-->
-<!--                                </goals>-->
-<!--                            </execution>-->
                             <execution>
-                                <id>push-images</id>
+                                <id>docker-push-image</id>
                                 <phase>deploy</phase>
                                 <goals>
                                     <goal>push</goal>
                                 </goals>
-                                <configuration>
-                                    <image>${docker-maven-plugin.image-name}</image>
-                                </configuration>
                             </execution>
                         </executions>
                         <configuration>
-                            <apiVersion>1.23</apiVersion>
-                            <registry>nexus3.onap.org:10001</registry>
-                            <authConfig>
-                                <pull>
-                                    <username>docker</username>
-                                    <password>docker</password>
-                                </pull>
-                            </authConfig>
+                            <skipPush>${skipDockerPush}</skipPush>
+                            <verbose>true</verbose>
+                            <imagePullPolicy>IfNotPresent</imagePullPolicy>
                             <images>
                                 <image>
-                                    <name>${docker-maven-plugin.image-name}</name>
-                                    <alias>cert-service</alias>
+                                    <alias>${project.artifactId}</alias>
+                                    <name>${docker-image.namespace}/${docker-image.name}
+                                    </name>
+                                    <registry>${docker-image.registry}</registry>
                                     <build>
-                                        <dockerFile>${project.basedir}/Dockerfile</dockerFile >
+                                        <dockerFileDir>${project.basedir}</dockerFileDir>
                                         <tags>
-                                            <tag>${docker.tag}</tag>
+                                            <tag>${project.version}-${maven.build.timestamp}Z</tag>
+                                            <tag>${project.version}</tag>
+                                            <tag>${docker-image.latest}</tag>
                                         </tags>
                                     </build>
-                                    <run>
-                                        <ports>
-                                            <port>8080:8080</port>
-                                        </ports>
-                                        <wait>
-                                            <!-- Check for this URL to return a 200 return code .... -->
-                                            <url>http://localhost:8080/actuator/health</url>
-                                            <time>120000</time>
-                                        </wait>
-                                    </run>
                                 </image>
                             </images>
                         </configuration>