From b32fb6d7da818acb14a0f4f5f8d3d2a7f7d07da8 Mon Sep 17 00:00:00 2001 From: pwielebs Date: Mon, 15 Jul 2019 17:25:26 +0200 Subject: Align PRH container to new guidelines MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I74af532bc6d4ce364c5d8cc2d0ac98386c0df11d Issue-ID: DCAEGEN2-1648 Signed-off-by: pwielebs Signed-off-by: Piotr Bocheński --- pom.xml | 13 +++- prh-app-server/Dockerfile | 32 ++++++++ prh-app-server/pom.xml | 192 ++++++++++++++++++++++++++-------------------- 3 files changed, 151 insertions(+), 86 deletions(-) create mode 100644 prh-app-server/Dockerfile diff --git a/pom.xml b/pom.xml index 6a20eb96..f6c97204 100644 --- a/pom.xml +++ b/pom.xml @@ -97,17 +97,22 @@ pl.project13.maven git-commit-id-plugin - 2.2.6 + 3.0.0 + + + org.codehaus.mojo + build-helper-maven-plugin + 3.0.0 org.apache.maven.plugins maven-jar-plugin - 3.1.1 + 3.1.2 - com.spotify + io.fabric8 docker-maven-plugin - 1.2.0 + 0.30.0 org.apache.maven.plugins diff --git a/prh-app-server/Dockerfile b/prh-app-server/Dockerfile new file mode 100644 index 00000000..a72ab448 --- /dev/null +++ b/prh-app-server/Dockerfile @@ -0,0 +1,32 @@ +FROM openjdk:8-jre-alpine + +LABEL copyright="Copyright (C) 2018-2019 NOKIA" \ + license.name="The Apache Software License, Version 2.0" \ + license.url="http://www.apache.org/licenses/LICENSE-2.0" \ + maintainer="Nokia Wroclaw ONAP Team" + +RUN adduser -h ${docker.user.dir} -D ${docker.user.name}; \ + chmod -R a+w /var/log + +USER ${docker.user.name} +WORKDIR ${docker.user.dir} + +EXPOSE 8100 8433 +ENTRYPOINT ["java", "-jar", "${project.artifactId}-${project.version}.jar"] + +COPY ${project.build.directory}/${ext.dep.dir.path}/ ${ext.dep.dir.path}/ +COPY ${project.build.directory}/${int.dep.dir.path}/ ${int.dep.dir.path}/ +COPY ${project.build.directory}/${project.artifactId}-${project.version}.jar . + +LABEL git.branch="${git.branch}" \ + git.build.host="${git.build.host}" \ + git.build.time="${git.build.time}" \ + git.build.user.email="${git.build.user.email}" \ + git.build.user.name="${git.build.user.name}" \ + git.build.version="${git.build.version}" \ + git.closest.tag.name="${git.closest.tag.name}" \ + git.commit.id="${git.commit.id}" \ + git.commit.message.short="${git.commit.message.short}" \ + git.commit.time="${git.commit.time}" \ + git.commit.user.email="${git.commit.user.email}" \ + git.commit.user.name="${git.commit.user.name}" diff --git a/prh-app-server/pom.xml b/prh-app-server/pom.xml index 89f25cee..cf33960d 100644 --- a/prh-app-server/pom.xml +++ b/prh-app-server/pom.xml @@ -37,12 +37,14 @@ yyyyMMdd'T'HHmmss org.onap.dcaegen2.services.prh.MainApp - libs - ${project.build.directory}/${dependency.dir.name} + @@ + libs + ${dep.dir.name}/external + ${dep.dir.name}/internal + false prh /home/${docker.user.name} - onap/${project.groupId}.${project.artifactId} @@ -71,116 +73,142 @@ - - org.apache.maven.plugins - maven-jar-plugin - - - - true - ./${dependency.dir.name}/ - false - ${prh.main.class} - true - - - ${maven.build.timestamp} - - - - + org.apache.maven.plugins maven-dependency-plugin - ${dependency.dir.location} - runtime true + runtime + ${classpath.separator} copy-external-dependencies - package + prepare-package copy-dependencies + build-classpath + + ${project.parent.groupId} + ${project.build.directory}/${ext.dep.dir.path} + ./${ext.dep.dir.path} + classpath.external + - - - - com.spotify - docker-maven-plugin - - ${onap.nexus.dockerregistry.daily} - ${docker.image.name} - - latest - - openjdk:${java.version}-jre-alpine - ${docker.user.dir} - - - ${dependency.dir.location} - ${dependency.dir.name} - - - ${project.build.directory} - ${project.build.finalName}.jar - - - - adduser -h ${docker.user.dir} -D ${docker.user.name}; chmod -R a+w /var/log - - - 8100 - 8433 - - ${docker.user.name} - ["java", "-jar", "${project.build.finalName}.jar"] - - - build-image - package + copy-internal-dependencies + prepare-package - build + copy-dependencies + build-classpath + + ${project.parent.groupId} + ${project.build.directory}/${int.dep.dir.path} + ./${int.dep.dir.path} + classpath.internal + + + + + + org.codehaus.mojo + build-helper-maven-plugin + - tag-and-push-image-latest - deploy + fix-classpath-separator + prepare-package - tag + regex-properties - ${docker.image.name}:latest - ${onap.nexus.dockerregistry.daily}/${docker.image.name}:latest - true + + + classpath.external + ${classpath.external} + ${classpath.separator} + + + + classpath.internal + ${classpath.internal} + ${classpath.separator} + + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + ${prh.main.class} + true + true + false + + + ${classpath.external} ${classpath.internal} + ${git.branch} + ${git.build.host} + ${git.build.time} + ${git.build.user.email} + ${git.build.user.name} + ${git.build.version} + ${git.closest.tag.name} + ${git.commit.id} + ${git.commit.message.short} + ${git.commit.time} + ${git.commit.user.email} + ${git.commit.user.name} + + + + + + + io.fabric8 + docker-maven-plugin + + ${skipDocker} + + + ${project.groupId}.${project.artifactId} + ${onap.nexus.dockerregistry.daily} + + ${project.basedir} + none + + latest + ${project.version} + ${project.version}-${maven.build.timestamp}Z + + + + + + - tag-and-push-image-with-version - deploy + docker-build-image + package - tag + build - - ${docker.image.name}:latest - ${onap.nexus.dockerregistry.daily}/${docker.image.name}:${project.version} - true - - tag-and-push-image-with-version-and-date + docker-push-image deploy - tag + push - - ${docker.image.name}:latest - ${onap.nexus.dockerregistry.daily}/${docker.image.name}:${project.version}-${maven.build.timestamp}Z - true - -- cgit 1.2.3-korg