diff options
author | k.kedron <k.kedron@partner.samsung.com> | 2021-04-16 14:38:52 +0200 |
---|---|---|
committer | Krystian Kedron <k.kedron@partner.samsung.com> | 2021-04-22 14:03:48 +0000 |
commit | 2f7a1b8783367c6804c6599569c72ad7d88ab267 (patch) | |
tree | 6c0e143b450238890cd53e07c7a9db26838d286a | |
parent | 442e160da964c94f39ce8b5b457cb10e96825386 (diff) |
Configure maven to produce docker images
For:
- datacollector rapp
- sleepingcelldetector rapp
Change-Id: If394448cb49d6ab082b37eeb49142cc5529789b7
Issue-ID: INT-1896
Signed-off-by: Krystian Kedron <k.kedron@partner.samsung.com>
-rw-r--r-- | datacollector/docker/.maven-dockerinclude | 1 | ||||
-rw-r--r-- | datacollector/docker/Dockerfile | 3 | ||||
-rw-r--r-- | datacollector/pom.xml | 54 | ||||
-rw-r--r-- | pom.xml | 31 | ||||
-rw-r--r-- | sleepingcelldetector/docker/Dockerfile | 4 | ||||
-rw-r--r-- | sleepingcelldetector/pom.xml | 58 |
6 files changed, 137 insertions, 14 deletions
diff --git a/datacollector/docker/.maven-dockerinclude b/datacollector/docker/.maven-dockerinclude deleted file mode 100644 index fd6cecd..0000000 --- a/datacollector/docker/.maven-dockerinclude +++ /dev/null @@ -1 +0,0 @@ -target/*.jar diff --git a/datacollector/docker/Dockerfile b/datacollector/docker/Dockerfile index 251673d..6d56ac8 100644 --- a/datacollector/docker/Dockerfile +++ b/datacollector/docker/Dockerfile @@ -1,5 +1,4 @@ FROM nexus3.onap.org:10001/onap/integration-java11:8.0.0 -ARG VERSION="" USER root @@ -9,6 +8,6 @@ USER onap EXPOSE 8087 -COPY *-${VERSION}.jar /app/service.jar +COPY datacollector*.jar /app/service.jar COPY init.sql start.sh /app/ ENTRYPOINT ["/bin/sh", "/app/start.sh"] diff --git a/datacollector/pom.xml b/datacollector/pom.xml index 141d212..db59334 100644 --- a/datacollector/pom.xml +++ b/datacollector/pom.xml @@ -28,10 +28,6 @@ <version>0.0.1-SNAPSHOT</version> </parent> - <properties> - <docker-image.name.prefix>org.onap.rapp.datacollector</docker-image.name.prefix> - </properties> - <dependencies> <dependency> <groupId>org.springframework.boot</groupId> @@ -90,6 +86,56 @@ <build> <plugins> <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-antrun-plugin</artifactId> + <version>1.8</version> + <executions> + <execution> + <phase>package</phase> + <configuration> + <target> + <copy file="target/${project.artifactId}-${project.version}.jar" tofile="./docker/${project.artifactId}-${project.version}.jar"/> + </target> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <groupId>io.fabric8</groupId> + <artifactId>docker-maven-plugin</artifactId> + <version>${docker-maven-plugin.version}</version> + <executions> + <execution> + <id>docker-build-image</id> + <phase>install</phase> + <goals> + <goal>build</goal> + <goal>push</goal> + </goals> + </execution> + </executions> + <configuration> + <skipPush>${skipDockerPush}</skipPush> + <verbose>true</verbose> + <imagePullPolicy>IfNotPresent</imagePullPolicy> + <images> + <image> + <name>${docker-image.namespace}/${docker-image.name.prefix}/${project.artifactId}</name> + <registry>${docker.registry}</registry> + <build> + <dockerFileDir>${project.basedir}/docker</dockerFileDir> + <tags> + <tag>${project.version}-${maven.build.timestamp}Z</tag> + </tags> + </build> + </image> + </images> + </configuration> + </plugin> + <plugin> <groupId>com.github.kongchen</groupId> <artifactId>swagger-maven-plugin</artifactId> <version>${swagger.maven.plugin.version}</version> @@ -27,15 +27,32 @@ </modules> <parent> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-parent</artifactId> - <version>2.3.0.RELEASE</version> + <groupId>org.onap.oparent</groupId> + <artifactId>oparent</artifactId> + <version>3.2.0</version> </parent> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-dependencies</artifactId> + <version>2.3.0.RELEASE</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + <properties> <java.version>11</java.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.build.timestamp.format>yyyyMMdd'T'HHmmss</maven.build.timestamp.format> + <skipDockerPush>true</skipDockerPush> + <docker.registry>nexus3.onap.org:10003</docker.registry> + <docker-maven-plugin.version>0.31.0</docker-maven-plugin.version> + <docker-image.namespace>onap</docker-image.namespace> + <docker-image.name.prefix>integration/usecase/a1-policy-enforcement</docker-image.name.prefix> <lombok.version>1.18.8</lombok.version> <mariadb.version>2.6.0</mariadb.version> @@ -76,6 +93,14 @@ <artifactId>maven-dependency-plugin</artifactId> </plugin> <plugin> + <groupId>io.fabric8</groupId> + <artifactId>docker-maven-plugin</artifactId> + <version>${docker-maven-plugin.version}</version> + <configuration> + <useColor>true</useColor> + </configuration> + </plugin> + <plugin> <artifactId>maven-resources-plugin</artifactId> </plugin> </plugins> diff --git a/sleepingcelldetector/docker/Dockerfile b/sleepingcelldetector/docker/Dockerfile new file mode 100644 index 0000000..0365146 --- /dev/null +++ b/sleepingcelldetector/docker/Dockerfile @@ -0,0 +1,4 @@ +FROM nexus3.onap.org:10001/onap/integration-java11:8.0.0 + +COPY sleepingcelldetector*.jar /app/service.jar +ENTRYPOINT exec java $JAVA_SEC_OPTS $JAVA_OPTS -jar /app/service.jar diff --git a/sleepingcelldetector/pom.xml b/sleepingcelldetector/pom.xml index 80b790d..0b067f8 100644 --- a/sleepingcelldetector/pom.xml +++ b/sleepingcelldetector/pom.xml @@ -26,10 +26,6 @@ <version>0.0.1-SNAPSHOT</version> </parent> - <properties> - <docker-image.name.prefix>org.onap.rapp.sleepingcelldetector</docker-image.name.prefix> - </properties> - <dependencies> <dependency> <groupId>org.springframework.boot</groupId> @@ -52,4 +48,58 @@ <version>28.2-android</version> </dependency> </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-antrun-plugin</artifactId> + <version>1.8</version> + <executions> + <execution> + <phase>package</phase> + <configuration> + <target> + <copy file="target/${project.artifactId}-${project.version}.jar" tofile="./docker/${project.artifactId}-${project.version}.jar"/> + </target> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <groupId>io.fabric8</groupId> + <artifactId>docker-maven-plugin</artifactId> + <version>${docker-maven-plugin.version}</version> + <executions> + <execution> + <id>docker-build-image</id> + <phase>install</phase> + <goals> + <goal>build</goal> + <goal>push</goal> + </goals> + </execution> + </executions> + <configuration> + <skipPush>${skipDockerPush}</skipPush> + <verbose>true</verbose> + <imagePullPolicy>IfNotPresent</imagePullPolicy> + <images> + <image> + <name>${docker-image.namespace}/${docker-image.name.prefix}/${project.artifactId}</name> + <registry>${docker.registry}</registry> + <build> + <dockerFileDir>${project.basedir}/docker</dockerFileDir> + <tags> + <tag>${project.version}-${maven.build.timestamp}Z</tag> + </tags> + </build> + </image> + </images> + </configuration> + </plugin> + </plugins> + </build> </project> |