From b1f8a58fc6e7be378f77d16510afaf8239f7231a Mon Sep 17 00:00:00 2001 From: Oweis Al-Agtash Date: Thu, 30 Nov 2023 14:59:29 +0100 Subject: [PATCH 1/3] Maven Docker Build improvements --- .gitignore | 1 + .../Dockerfile | 2 + .../pom.xml | 107 ++++++++--------- .../basyx.aasenvironment.component/pom.xml | 102 +++++++--------- basyx.aasregistry/pom.xml | 83 +++---------- .../basyx.aasrepository.component/pom.xml | 110 ++++++++---------- .../pom.xml | 102 +++++++--------- basyx.submodelregistry/pom.xml | 81 +++---------- .../pom.xml | 107 +++++++---------- .../basyx.submodelservice.component/pom.xml | 49 +++++++- pom.xml | 67 ++++++++++- 11 files changed, 365 insertions(+), 446 deletions(-) diff --git a/.gitignore b/.gitignore index 1cda58599..ecadeccfa 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ /.vs /.vscode /.idea +**.iml launchSettings.json .project *.pubxml diff --git a/basyx.aasdiscoveryservice/basyx.aasdiscoveryservice.component/Dockerfile b/basyx.aasdiscoveryservice/basyx.aasdiscoveryservice.component/Dockerfile index 6f239ba9b..aae318acd 100644 --- a/basyx.aasdiscoveryservice/basyx.aasdiscoveryservice.component/Dockerfile +++ b/basyx.aasdiscoveryservice/basyx.aasdiscoveryservice.component/Dockerfile @@ -5,5 +5,7 @@ ARG JAR_FILE=target/*-exec.jar COPY ${JAR_FILE} basyxExecutable.jar COPY src/main/resources/application.properties application.properties ARG PORT=8081 +ENV PORT=${PORT} EXPOSE ${PORT} +HEALTHCHECK --interval=30s --timeout=3s --retries=3 --start-period=15s CMD curl --fail http://localhost:${PORT}/actuator/health || exit 1 ENTRYPOINT ["java","-jar","basyxExecutable.jar"] diff --git a/basyx.aasdiscoveryservice/basyx.aasdiscoveryservice.component/pom.xml b/basyx.aasdiscoveryservice/basyx.aasdiscoveryservice.component/pom.xml index 1898805cd..acf3211f9 100644 --- a/basyx.aasdiscoveryservice/basyx.aasdiscoveryservice.component/pom.xml +++ b/basyx.aasdiscoveryservice/basyx.aasdiscoveryservice.component/pom.xml @@ -111,78 +111,63 @@ - - - - - - io.fabric8 - docker-maven-plugin - 0.43.0 - - - - ${docker.username}/${docker.image.name} - - - ${docker.image.tag} - - ${project.basedir} - - - - ${docker.host.port}:${docker.container.port} - - - ${docker.container.waitForEndpoint} - - - - - - true - - - - docker:build - package - - build - - - - docker-compose-up - pre-integration-test - - start - - - - docker-compose-down - post-integration-test - - stop - - - - - - docker + + + docker.namespace + + io.fabric8 docker-maven-plugin + + + + + + ${docker.host.port}:${docker.container.port} + + + ${docker.container.waitForEndpoint} + + + + + + + + + build-docker + + + push-docker + + + docker-compose-up + pre-integration-test + + start + + + + docker-compose-down + post-integration-test + + stop + + + - - org.apache.maven.plugins - maven-failsafe-plugin - + + org.apache.maven.plugins + maven-failsafe-plugin + diff --git a/basyx.aasenvironment/basyx.aasenvironment.component/pom.xml b/basyx.aasenvironment/basyx.aasenvironment.component/pom.xml index 10dfb5acb..461a8d9ba 100644 --- a/basyx.aasenvironment/basyx.aasenvironment.component/pom.xml +++ b/basyx.aasenvironment/basyx.aasenvironment.component/pom.xml @@ -114,74 +114,58 @@ - - - - - - io.fabric8 - docker-maven-plugin - 0.43.0 - - - - ${docker.namespace}/${docker.image.name} - - - ${docker.image.tag} - - ${project.basedir} - - - - - ${docker.host.port}:${docker.container.port} - - - ${docker.container.waitForEndpoint} - - - - - - true - - - - docker:build - package - - build - - - - docker-compose-up - pre-integration-test - - start - - - - docker-compose-down - post-integration-test - - stop - - - - - - docker + + + docker.namespace + + io.fabric8 docker-maven-plugin + + + + + + ${docker.host.port}:${docker.container.port} + + + ${docker.container.waitForEndpoint} + + + + + + + + + build-docker + + + push-docker + + + docker-compose-up + pre-integration-test + + start + + + + docker-compose-down + post-integration-test + + stop + + + org.apache.maven.plugins @@ -191,4 +175,4 @@ - \ No newline at end of file + diff --git a/basyx.aasregistry/pom.xml b/basyx.aasregistry/pom.xml index d20c24047..0c5634bd7 100644 --- a/basyx.aasregistry/pom.xml +++ b/basyx.aasregistry/pom.xml @@ -13,9 +13,8 @@ - 2.0.0-SNAPSHOT 1.18.20.0 - 11 + 17 ${java.version} ${java.version} UTF-8 @@ -30,12 +29,7 @@ 3.6.0 3.0-alpha-2 0.9.4 - 2.2 - 0.43.4 ${project.artifactId} - docker.io - linux/amd64,linux/arm64 - docker.io 6.6.0 0.2.6 3.0.2 @@ -101,11 +95,6 @@ openapi-generator-maven-plugin ${openapitools.version} - - io.fabric8 - docker-maven-plugin - ${docker.maven.plugin.version} - de.dfki.cos.basys.common jsonpatch-maven-plugin @@ -259,8 +248,7 @@ dockerbuild - + src/main/docker/Dockerfile @@ -290,66 +278,25 @@ io.fabric8 docker-maven-plugin + + + + + + artifact + + Dockerfile + ${project.basedir}/src/main/docker + + + + build-docker - package - - build - - - - - ${docker.namespace}/${docker.image.name} - - - artifact - - - ${docker.image.version} - - Dockerfile - ${project.basedir}/src/main/docker - - true - - - - push-docker - deploy - - build - push - - - - - ${docker.namespace}/${docker.image.name} - - https://index.docker.io/v1/ - - - artifact - - - ${docker.image.version} - - Dockerfile - ${project.basedir}/src/main/docker - - ${docker.target.platforms} - - ${docker.provenance} - - - true - - - - diff --git a/basyx.aasrepository/basyx.aasrepository.component/pom.xml b/basyx.aasrepository/basyx.aasrepository.component/pom.xml index 41aef57ae..bd3421794 100644 --- a/basyx.aasrepository/basyx.aasrepository.component/pom.xml +++ b/basyx.aasrepository/basyx.aasrepository.component/pom.xml @@ -13,8 +13,7 @@ aas-repository - - http://localhost:${docker.host.port}/shells + http://localhost:${docker.host.port}/shells @@ -120,78 +119,61 @@ - - - - - - io.fabric8 - docker-maven-plugin - 0.43.4 - - - - ${docker.namespace}/${docker.image.name} - - - ${docker.image.tag} - - ${project.basedir} - - - - - ${docker.host.port}:${docker.container.port} - - - ${docker.container.waitForEndpoint} - - - - - integration - - - - - true - - - - docker:build - package - - build - - - - docker-compose-up - pre-integration-test - - start - - - - docker-compose-down - post-integration-test - - stop - - - - - - docker + + + docker.namespace + + io.fabric8 docker-maven-plugin + + + + + + ${docker.host.port}:${docker.container.port} + + + ${docker.container.waitForEndpoint} + + + + integration + + + + + + + + build-docker + + + push-docker + + + docker-compose-up + pre-integration-test + + start + + + + docker-compose-down + post-integration-test + + stop + + + org.apache.maven.plugins diff --git a/basyx.conceptdescriptionrepository/basyx.conceptdescriptionrepository.component/pom.xml b/basyx.conceptdescriptionrepository/basyx.conceptdescriptionrepository.component/pom.xml index 0ab8621a6..85850b976 100644 --- a/basyx.conceptdescriptionrepository/basyx.conceptdescriptionrepository.component/pom.xml +++ b/basyx.conceptdescriptionrepository/basyx.conceptdescriptionrepository.component/pom.xml @@ -13,8 +13,7 @@ conceptdescription-repository - http://localhost:${docker.host.port}/concept-descriptions - + http://localhost:${docker.host.port}/concept-descriptions @@ -113,73 +112,58 @@ - - - - - - io.fabric8 - docker-maven-plugin - 0.43.4 - - - - ${docker.namespace}/${docker.image.name} - - - ${docker.image.tag} - - ${project.basedir} - - - - ${docker.host.port}:${docker.container.port} - - - ${docker.container.waitForEndpoint} - - - - - - true - - - - docker:build - package - - build - - - - docker-compose-up - pre-integration-test - - start - - - - docker-compose-down - post-integration-test - - stop - - - - - - docker + + + docker.namespace + + io.fabric8 docker-maven-plugin + + + + + + ${docker.host.port}:${docker.container.port} + + + ${docker.container.waitForEndpoint} + + + + + + + + + build-docker + + + push-docker + + + docker-compose-up + pre-integration-test + + start + + + + docker-compose-down + post-integration-test + + stop + + + org.apache.maven.plugins diff --git a/basyx.submodelregistry/pom.xml b/basyx.submodelregistry/pom.xml index 048c9acac..514859c66 100644 --- a/basyx.submodelregistry/pom.xml +++ b/basyx.submodelregistry/pom.xml @@ -13,7 +13,6 @@ - 2.0.0-SNAPSHOT 1.18.20.0 17 ${java.version} @@ -29,12 +28,7 @@ 3.6.0 3.0-alpha-2 0.9.4 - 2.2 - 0.43.4 ${project.artifactId} - docker.io - linux/amd64,linux/arm64 - docker.io 6.6.0 0.2.6 3.0.2 @@ -88,11 +82,6 @@ openapi-generator-maven-plugin ${openapitools.version} - - io.fabric8 - docker-maven-plugin - ${docker.maven.plugin.version} - de.dfki.cos.basys.common jsonpatch-maven-plugin @@ -241,8 +230,7 @@ dockerbuild - + src/main/docker/Dockerfile @@ -272,66 +260,25 @@ io.fabric8 docker-maven-plugin + + + + + + artifact + + Dockerfile + ${project.basedir}/src/main/docker + + + + build-docker - package - - build - - - - - ${docker.namespace}/${docker.image.name} - - - artifact - - - ${docker.image.version} - - Dockerfile - ${project.basedir}/src/main/docker - - true - - - - push-docker - deploy - - build - push - - - - - ${docker.namespace}/${docker.image.name} - - https://index.docker.io/v1/ - - - artifact - - - ${docker.image.version} - - Dockerfile - ${project.basedir}/src/main/docker - - ${docker.target.platforms} - - ${docker.provenance} - - - true - - - - diff --git a/basyx.submodelrepository/basyx.submodelrepository.component/pom.xml b/basyx.submodelrepository/basyx.submodelrepository.component/pom.xml index 7e95bfdfc..38cbd01f1 100644 --- a/basyx.submodelrepository/basyx.submodelrepository.component/pom.xml +++ b/basyx.submodelrepository/basyx.submodelrepository.component/pom.xml @@ -126,78 +126,61 @@ - - - - - - io.fabric8 - docker-maven-plugin - 0.43.4 - - - - ${docker.namespace}/${docker.image.name} - - - ${docker.image.tag} - - ${project.basedir} - - - - - ${docker.host.port}:${docker.container.port} - - - ${docker.container.waitForEndpoint} - - - - - integration - - - - - true - - - - docker:build - package - - build - - - - docker-compose-up - pre-integration-test - - start - - - - docker-compose-down - post-integration-test - - stop - - - - - - docker + + + docker.namespace + + io.fabric8 docker-maven-plugin + + + + + + ${docker.host.port}:${docker.container.port} + + + ${docker.container.waitForEndpoint} + + + + integration + + + + + + + + build-docker + + + push-docker + + + docker-compose-up + pre-integration-test + + start + + + + docker-compose-down + post-integration-test + + stop + + + org.apache.maven.plugins diff --git a/basyx.submodelservice/basyx.submodelservice.component/pom.xml b/basyx.submodelservice/basyx.submodelservice.component/pom.xml index e2c927378..18956ef26 100644 --- a/basyx.submodelservice/basyx.submodelservice.component/pom.xml +++ b/basyx.submodelservice/basyx.submodelservice.component/pom.xml @@ -71,18 +71,61 @@ + docker + + + docker.namespace + + io.fabric8 docker-maven-plugin + + + + + + ${docker.host.port}:${docker.container.port} + + + ${docker.container.waitForEndpoint} + + + + + + + + + build-docker + + + push-docker + + + docker-compose-up + pre-integration-test + + start + + + + docker-compose-down + post-integration-test + + stop + + + - - org.apache.maven.plugins - maven-failsafe-plugin + + org.apache.maven.plugins + maven-failsafe-plugin diff --git a/pom.xml b/pom.xml index fda865685..e1ea34d6c 100644 --- a/pom.xml +++ b/pom.xml @@ -48,9 +48,11 @@ UTF-8 UTF-8 2.0.0-SNAPSHOT - - eclipsebasyx - ${revision} + + eclipsebasyx + NOT_DEFINED_IN_MODULE + ${revision} + linux/amd64,linux/arm64 8081 8081 1.0.0-milestone-04 @@ -158,6 +160,60 @@ + + io.fabric8 + docker-maven-plugin + 0.43.4 + + + + ${docker.namespace}/${docker.image.name}:${docker.image.tag} + + ${project.basedir} + + + + ${project.version} + ${maven.build.timestamp} + + true + + + + true + + + + build-docker + package + + build + + + + push-docker + deploy + + build + push + + + + + + + ${docker.target.platforms} + + ${docker.provenance} + + + + + + + + + @@ -218,6 +274,11 @@ + + org.yaml + snakeyaml + 2.2 + org.springdoc springdoc-openapi-starter-webmvc-ui From 85e1cfb42b978d765725fd1faed989de0c5c8d0e Mon Sep 17 00:00:00 2001 From: Oweis Al-Agtash Date: Mon, 4 Dec 2023 11:13:57 +0100 Subject: [PATCH 2/3] Fixing build. --- basyx.aasregistry/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basyx.aasregistry/pom.xml b/basyx.aasregistry/pom.xml index 0c5634bd7..febf22649 100644 --- a/basyx.aasregistry/pom.xml +++ b/basyx.aasregistry/pom.xml @@ -14,7 +14,7 @@ 1.18.20.0 - 17 + 11 ${java.version} ${java.version} UTF-8 From b33b75982d9857cea487a262c3a1860804a89773 Mon Sep 17 00:00:00 2001 From: Oweis Al-Agtash Date: Mon, 4 Dec 2023 15:39:18 +0100 Subject: [PATCH 3/3] Match docker healthcheck port with application running port. --- .../basyx.aasdiscoveryservice.component/Dockerfile | 6 +++--- .../basyx.aasxfileserver.component/Dockerfile | 6 +++--- .../basyx.conceptdescriptionrepository.component/Dockerfile | 2 +- .../basyx.submodelrepository.component/Dockerfile | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/basyx.aasdiscoveryservice/basyx.aasdiscoveryservice.component/Dockerfile b/basyx.aasdiscoveryservice/basyx.aasdiscoveryservice.component/Dockerfile index aae318acd..e2c0874b1 100644 --- a/basyx.aasdiscoveryservice/basyx.aasdiscoveryservice.component/Dockerfile +++ b/basyx.aasdiscoveryservice/basyx.aasdiscoveryservice.component/Dockerfile @@ -5,7 +5,7 @@ ARG JAR_FILE=target/*-exec.jar COPY ${JAR_FILE} basyxExecutable.jar COPY src/main/resources/application.properties application.properties ARG PORT=8081 -ENV PORT=${PORT} -EXPOSE ${PORT} -HEALTHCHECK --interval=30s --timeout=3s --retries=3 --start-period=15s CMD curl --fail http://localhost:${PORT}/actuator/health || exit 1 +ENV SERVER_PORT=${PORT} +EXPOSE ${SERVER_PORT} +HEALTHCHECK --interval=30s --timeout=3s --retries=3 --start-period=15s CMD curl --fail http://localhost:${SERVER_PORT}/actuator/health || exit 1 ENTRYPOINT ["java","-jar","basyxExecutable.jar"] diff --git a/basyx.aasxfileserver/basyx.aasxfileserver.component/Dockerfile b/basyx.aasxfileserver/basyx.aasxfileserver.component/Dockerfile index 61c48a0f4..1c3e9648d 100644 --- a/basyx.aasxfileserver/basyx.aasxfileserver.component/Dockerfile +++ b/basyx.aasxfileserver/basyx.aasxfileserver.component/Dockerfile @@ -5,7 +5,7 @@ ARG JAR_FILE=target/*-exec.jar COPY ${JAR_FILE} basyxExecutable.jar COPY src/main/resources/application.properties application.properties ARG PORT=8081 -ENV PORT=${PORT} -EXPOSE ${PORT} -HEALTHCHECK --interval=30s --timeout=3s --retries=3 --start-period=15s CMD curl --fail http://localhost:${PORT}/actuator/health || exit 1 +ENV SERVER_PORT=${PORT} +EXPOSE ${SERVER_PORT} +HEALTHCHECK --interval=30s --timeout=3s --retries=3 --start-period=15s CMD curl --fail http://localhost:${SERVER_PORT}/actuator/health || exit 1 ENTRYPOINT ["java","-jar","basyxExecutable.jar"] diff --git a/basyx.conceptdescriptionrepository/basyx.conceptdescriptionrepository.component/Dockerfile b/basyx.conceptdescriptionrepository/basyx.conceptdescriptionrepository.component/Dockerfile index 685afc783..850188a4c 100644 --- a/basyx.conceptdescriptionrepository/basyx.conceptdescriptionrepository.component/Dockerfile +++ b/basyx.conceptdescriptionrepository/basyx.conceptdescriptionrepository.component/Dockerfile @@ -6,6 +6,6 @@ COPY ${JAR_FILE} basyxExecutable.jar COPY src/main/resources/application.properties application.properties ARG PORT=8081 ENV SERVER_PORT=${PORT} -EXPOSE ${PORT} +EXPOSE ${SERVER_PORT} HEALTHCHECK --interval=30s --timeout=3s --retries=3 --start-period=30s CMD curl --fail http://localhost:${SERVER_PORT}/actuator/health || exit 1 ENTRYPOINT ["java","-jar","basyxExecutable.jar"] diff --git a/basyx.submodelrepository/basyx.submodelrepository.component/Dockerfile b/basyx.submodelrepository/basyx.submodelrepository.component/Dockerfile index c6f045a36..1c3e9648d 100644 --- a/basyx.submodelrepository/basyx.submodelrepository.component/Dockerfile +++ b/basyx.submodelrepository/basyx.submodelrepository.component/Dockerfile @@ -7,5 +7,5 @@ COPY src/main/resources/application.properties application.properties ARG PORT=8081 ENV SERVER_PORT=${PORT} EXPOSE ${SERVER_PORT} -HEALTHCHECK --interval=30s --timeout=3s --retries=3 --start-period=15s CMD curl --fail http://localhost:${PORT}/actuator/health || exit 1 +HEALTHCHECK --interval=30s --timeout=3s --retries=3 --start-period=15s CMD curl --fail http://localhost:${SERVER_PORT}/actuator/health || exit 1 ENTRYPOINT ["java","-jar","basyxExecutable.jar"]