diff --git a/.github/workflows/docker-snapshot-release.yml b/.github/workflows/docker-snapshot-release.yml index 99c3c20eb..03421f070 100644 --- a/.github/workflows/docker-snapshot-release.yml +++ b/.github/workflows/docker-snapshot-release.yml @@ -80,8 +80,19 @@ jobs: distribution: 'temurin' cache: maven - - name: Install BaSyx - run: mvn clean install -DskipTests + # Build the project + # For registry modules, we activate the dockerbuild profile and specify the module with --pl + - name: Build BaSyx + run: | + if [[ "${{ matrix.name }}" == *"registry"* ]]; then + # Derive the module's artifactId from the path + module_root=$(dirname "$(dirname "$(dirname "${{ matrix.path }}")")") + artifact_id=$(basename "$module_root") + # Run with dockerbuild profile and namespace + mvn clean install -DskipTests -Pdockerbuild "-Ddocker.namespace=aaronzi" --pl "org.eclipse.digitaltwin.basyx:${artifact_id}" + else + mvn clean install -DskipTests + fi - name: Prepare Registry JAR for Docker if: contains(matrix.name, 'registry') @@ -89,10 +100,10 @@ jobs: # Go three levels up from src/main/docker to get the module root module_root=$(dirname "$(dirname "$(dirname "${{ matrix.path }}")")") - # Find the JAR in the module's target directory - JAR_FILE=$(ls "$module_root/target/"*.jar | head -n 1) + # Find the large JAR after repackage (enabled by dockerbuild profile) + JAR_FILE=$(ls "$module_root/target/"*.jar | grep -v original | head -n 1) if [ -z "$JAR_FILE" ]; then - echo "No JAR found in $module_root/target. Check your build." + echo "No repackaged JAR found in $module_root/target. Check your build." exit 1 fi diff --git a/basyx.aasregistry/basyx.aasregistry-service-release-kafka-mem/src/main/docker/Dockerfile b/basyx.aasregistry/basyx.aasregistry-service-release-kafka-mem/src/main/docker/Dockerfile index 5f1f7e452..a5cb3a888 100644 --- a/basyx.aasregistry/basyx.aasregistry-service-release-kafka-mem/src/main/docker/Dockerfile +++ b/basyx.aasregistry/basyx.aasregistry-service-release-kafka-mem/src/main/docker/Dockerfile @@ -1,5 +1,5 @@ FROM eclipse-temurin:17 as builder -ARG FINAL_NAME +ARG FINAL_NAME=${project.build.finalName} COPY maven/${FINAL_NAME}.jar ./ RUN java -Djarmode=layertools -jar ${FINAL_NAME}.jar extract diff --git a/basyx.aasregistry/basyx.aasregistry-service-release-kafka-mongodb/src/main/docker/Dockerfile b/basyx.aasregistry/basyx.aasregistry-service-release-kafka-mongodb/src/main/docker/Dockerfile index fdef8d7bd..d408d753e 100644 --- a/basyx.aasregistry/basyx.aasregistry-service-release-kafka-mongodb/src/main/docker/Dockerfile +++ b/basyx.aasregistry/basyx.aasregistry-service-release-kafka-mongodb/src/main/docker/Dockerfile @@ -1,5 +1,5 @@ FROM eclipse-temurin:17 as builder -ARG FINAL_NAME +ARG FINAL_NAME=${project.build.finalName} COPY maven/${FINAL_NAME}.jar ./ RUN java -Djarmode=layertools -jar ${FINAL_NAME}.jar extract diff --git a/basyx.aasregistry/basyx.aasregistry-service-release-log-mem/src/main/docker/Dockerfile b/basyx.aasregistry/basyx.aasregistry-service-release-log-mem/src/main/docker/Dockerfile index 7fc7f89aa..8ba0cf83a 100644 --- a/basyx.aasregistry/basyx.aasregistry-service-release-log-mem/src/main/docker/Dockerfile +++ b/basyx.aasregistry/basyx.aasregistry-service-release-log-mem/src/main/docker/Dockerfile @@ -1,5 +1,5 @@ FROM eclipse-temurin:17 as builder -ARG FINAL_NAME +ARG FINAL_NAME=${project.build.finalName} COPY maven/${FINAL_NAME}.jar ./ RUN java -Djarmode=layertools -jar ${FINAL_NAME}.jar extract diff --git a/basyx.aasregistry/basyx.aasregistry-service-release-log-mongodb/src/main/docker/Dockerfile b/basyx.aasregistry/basyx.aasregistry-service-release-log-mongodb/src/main/docker/Dockerfile index 66d87a0c9..df632dacc 100644 --- a/basyx.aasregistry/basyx.aasregistry-service-release-log-mongodb/src/main/docker/Dockerfile +++ b/basyx.aasregistry/basyx.aasregistry-service-release-log-mongodb/src/main/docker/Dockerfile @@ -1,5 +1,5 @@ FROM eclipse-temurin:17 as builder -ARG FINAL_NAME +ARG FINAL_NAME=${project.build.finalName} COPY maven/${FINAL_NAME}.jar ./ RUN java -Djarmode=layertools -jar ${FINAL_NAME}.jar extract diff --git a/basyx.submodelregistry/basyx.submodelregistry-service-release-kafka-mem/src/main/docker/Dockerfile b/basyx.submodelregistry/basyx.submodelregistry-service-release-kafka-mem/src/main/docker/Dockerfile index 5f1f7e452..a5cb3a888 100644 --- a/basyx.submodelregistry/basyx.submodelregistry-service-release-kafka-mem/src/main/docker/Dockerfile +++ b/basyx.submodelregistry/basyx.submodelregistry-service-release-kafka-mem/src/main/docker/Dockerfile @@ -1,5 +1,5 @@ FROM eclipse-temurin:17 as builder -ARG FINAL_NAME +ARG FINAL_NAME=${project.build.finalName} COPY maven/${FINAL_NAME}.jar ./ RUN java -Djarmode=layertools -jar ${FINAL_NAME}.jar extract diff --git a/basyx.submodelregistry/basyx.submodelregistry-service-release-kafka-mongodb/src/main/docker/Dockerfile b/basyx.submodelregistry/basyx.submodelregistry-service-release-kafka-mongodb/src/main/docker/Dockerfile index fdef8d7bd..d408d753e 100644 --- a/basyx.submodelregistry/basyx.submodelregistry-service-release-kafka-mongodb/src/main/docker/Dockerfile +++ b/basyx.submodelregistry/basyx.submodelregistry-service-release-kafka-mongodb/src/main/docker/Dockerfile @@ -1,5 +1,5 @@ FROM eclipse-temurin:17 as builder -ARG FINAL_NAME +ARG FINAL_NAME=${project.build.finalName} COPY maven/${FINAL_NAME}.jar ./ RUN java -Djarmode=layertools -jar ${FINAL_NAME}.jar extract diff --git a/basyx.submodelregistry/basyx.submodelregistry-service-release-log-mem/src/main/docker/Dockerfile b/basyx.submodelregistry/basyx.submodelregistry-service-release-log-mem/src/main/docker/Dockerfile index 7fc7f89aa..8ba0cf83a 100644 --- a/basyx.submodelregistry/basyx.submodelregistry-service-release-log-mem/src/main/docker/Dockerfile +++ b/basyx.submodelregistry/basyx.submodelregistry-service-release-log-mem/src/main/docker/Dockerfile @@ -1,5 +1,5 @@ FROM eclipse-temurin:17 as builder -ARG FINAL_NAME +ARG FINAL_NAME=${project.build.finalName} COPY maven/${FINAL_NAME}.jar ./ RUN java -Djarmode=layertools -jar ${FINAL_NAME}.jar extract diff --git a/basyx.submodelregistry/basyx.submodelregistry-service-release-log-mongodb/src/main/docker/Dockerfile b/basyx.submodelregistry/basyx.submodelregistry-service-release-log-mongodb/src/main/docker/Dockerfile index 66d87a0c9..df632dacc 100644 --- a/basyx.submodelregistry/basyx.submodelregistry-service-release-log-mongodb/src/main/docker/Dockerfile +++ b/basyx.submodelregistry/basyx.submodelregistry-service-release-log-mongodb/src/main/docker/Dockerfile @@ -1,5 +1,5 @@ FROM eclipse-temurin:17 as builder -ARG FINAL_NAME +ARG FINAL_NAME=${project.build.finalName} COPY maven/${FINAL_NAME}.jar ./ RUN java -Djarmode=layertools -jar ${FINAL_NAME}.jar extract