This is an automated email from the ASF dual-hosted git repository.

riemer pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/streampipes.git


The following commit(s) were added to refs/heads/dev by this push:
     new f31563b07 feat(#2161): Generate layered Docker images (#2162)
f31563b07 is described below

commit f31563b07706a1ceac2d7ca7c243f7f4305e0a26
Author: Dominik Riemer <[email protected]>
AuthorDate: Fri Nov 10 16:46:02 2023 +0100

    feat(#2161): Generate layered Docker images (#2162)
---
 .../streampipes-extensions-all-iiot/Dockerfile          | 17 ++++++++++-------
 .../streampipes-extensions-all-iiot/pom.xml             |  5 +++++
 .../streampipes-extensions-all-jvm/Dockerfile           | 14 ++++++++++----
 .../streampipes-extensions-all-jvm/pom.xml              |  5 +++++
 .../streampipes-extensions-iiot-minimal/Dockerfile      | 14 ++++++++++----
 .../streampipes-extensions-iiot-minimal/pom.xml         |  5 +++++
 streampipes-service-core-minimal/Dockerfile             | 14 ++++++++++----
 streampipes-service-core-minimal/pom.xml                |  3 +++
 streampipes-service-core/Dockerfile                     | 14 ++++++++++----
 streampipes-service-core/pom.xml                        |  3 +++
 10 files changed, 71 insertions(+), 23 deletions(-)

diff --git a/streampipes-extensions/streampipes-extensions-all-iiot/Dockerfile 
b/streampipes-extensions/streampipes-extensions-all-iiot/Dockerfile
index e286b256d..a53114ad3 100644
--- a/streampipes-extensions/streampipes-extensions-all-iiot/Dockerfile
+++ b/streampipes-extensions/streampipes-extensions-all-iiot/Dockerfile
@@ -13,11 +13,14 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-FROM eclipse-temurin:17-jre-focal
-
-# needed pkgs processors-image-processing-jvm
-RUN apt-get update && apt-get install ttf-dejavu-core && apt-get install 
fontconfig
+FROM eclipse-temurin:17-jre-focal as builder
+ARG JAR_FILE=target/streampipes-extensions-all-iiot.jar
+COPY ${JAR_FILE} application.jar
+RUN java -Djarmode=layertools -jar application.jar extract
 
-COPY target/streampipes-extensions-all-iiot.jar  
/streampipes-extensions-all-iiot.jar
-
-ENTRYPOINT ["java", "-jar", "/streampipes-extensions-all-iiot.jar"]
+FROM eclipse-temurin:17-jre-focal
+COPY --from=builder dependencies/ ./
+COPY --from=builder snapshot-dependencies/ ./
+COPY --from=builder spring-boot-loader/ ./
+COPY --from=builder application/ ./
+ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher"]
diff --git a/streampipes-extensions/streampipes-extensions-all-iiot/pom.xml 
b/streampipes-extensions/streampipes-extensions-all-iiot/pom.xml
index b07002863..d2f01f404 100644
--- a/streampipes-extensions/streampipes-extensions-all-iiot/pom.xml
+++ b/streampipes-extensions/streampipes-extensions-all-iiot/pom.xml
@@ -232,6 +232,11 @@
                         </configuration>
                     </execution>
                 </executions>
+                <configuration>
+                    <layers>
+                        <enabled>true</enabled>
+                    </layers>
+                </configuration>
             </plugin>
         </plugins>
         <finalName>streampipes-extensions-all-iiot</finalName>
diff --git a/streampipes-extensions/streampipes-extensions-all-jvm/Dockerfile 
b/streampipes-extensions/streampipes-extensions-all-jvm/Dockerfile
index efc90dfa2..558320271 100644
--- a/streampipes-extensions/streampipes-extensions-all-jvm/Dockerfile
+++ b/streampipes-extensions/streampipes-extensions-all-jvm/Dockerfile
@@ -13,11 +13,17 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-FROM eclipse-temurin:17-jre-focal
+FROM eclipse-temurin:17-jre-focal as builder
+ARG JAR_FILE=target/streampipes-extensions-all-jvm.jar
+COPY ${JAR_FILE} application.jar
+RUN java -Djarmode=layertools -jar application.jar extract
 
+FROM eclipse-temurin:17-jre-focal
 # needed pkgs processors-image-processing-jvm
 RUN apt-get update && apt-get install ttf-dejavu-core && apt-get install 
fontconfig
 
-COPY target/streampipes-extensions-all-jvm.jar  
/streampipes-extensions-all-jvm.jar
-
-ENTRYPOINT ["java", "-jar", "/streampipes-extensions-all-jvm.jar"]
\ No newline at end of file
+COPY --from=builder dependencies/ ./
+COPY --from=builder snapshot-dependencies/ ./
+COPY --from=builder spring-boot-loader/ ./
+COPY --from=builder application/ ./
+ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher"]
diff --git a/streampipes-extensions/streampipes-extensions-all-jvm/pom.xml 
b/streampipes-extensions/streampipes-extensions-all-jvm/pom.xml
index 7a004ffc9..2c7015ef8 100644
--- a/streampipes-extensions/streampipes-extensions-all-jvm/pom.xml
+++ b/streampipes-extensions/streampipes-extensions-all-jvm/pom.xml
@@ -286,6 +286,11 @@
                         </configuration>
                     </execution>
                 </executions>
+                <configuration>
+                    <layers>
+                        <enabled>true</enabled>
+                    </layers>
+                </configuration>
             </plugin>
         </plugins>
         <finalName>streampipes-extensions-all-jvm</finalName>
diff --git 
a/streampipes-extensions/streampipes-extensions-iiot-minimal/Dockerfile 
b/streampipes-extensions/streampipes-extensions-iiot-minimal/Dockerfile
index 93bc8f7f7..5c449815c 100644
--- a/streampipes-extensions/streampipes-extensions-iiot-minimal/Dockerfile
+++ b/streampipes-extensions/streampipes-extensions-iiot-minimal/Dockerfile
@@ -13,8 +13,14 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-FROM eclipse-temurin:17-jre-focal
-
-COPY target/streampipes-extensions-iiot-minimal.jar  
/streampipes-extensions-iiot-minimal.jar
+FROM eclipse-temurin:17-jre-focal as builder
+ARG JAR_FILE=target/streampipes-extensions-iiot-minimal.jar
+COPY ${JAR_FILE} application.jar
+RUN java -Djarmode=layertools -jar application.jar extract
 
-ENTRYPOINT ["java", "-jar", "/streampipes-extensions-iiot-minimal.jar"]
+FROM eclipse-temurin:17-jre-focal
+COPY --from=builder dependencies/ ./
+COPY --from=builder snapshot-dependencies/ ./
+COPY --from=builder spring-boot-loader/ ./
+COPY --from=builder application/ ./
+ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher"]
diff --git a/streampipes-extensions/streampipes-extensions-iiot-minimal/pom.xml 
b/streampipes-extensions/streampipes-extensions-iiot-minimal/pom.xml
index 9298a4c3b..ca5af8c7d 100644
--- a/streampipes-extensions/streampipes-extensions-iiot-minimal/pom.xml
+++ b/streampipes-extensions/streampipes-extensions-iiot-minimal/pom.xml
@@ -214,6 +214,11 @@
                         </configuration>
                     </execution>
                 </executions>
+                <configuration>
+                <layers>
+                    <enabled>true</enabled>
+                </layers>
+                </configuration>
             </plugin>
         </plugins>
         <finalName>streampipes-extensions-iiot-minimal</finalName>
diff --git a/streampipes-service-core-minimal/Dockerfile 
b/streampipes-service-core-minimal/Dockerfile
index 7970c3e71..8ed146c1a 100644
--- a/streampipes-service-core-minimal/Dockerfile
+++ b/streampipes-service-core-minimal/Dockerfile
@@ -13,8 +13,14 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-FROM eclipse-temurin:17-jre-focal
-
-COPY target/streampipes-core-minimal.jar  /streampipes-core.jar
+FROM eclipse-temurin:17-jre-focal as builder
+ARG JAR_FILE=target/streampipes-core-minimal.jar
+COPY ${JAR_FILE} application.jar
+RUN java -Djarmode=layertools -jar application.jar extract
 
-ENTRYPOINT ["java", "-jar", "/streampipes-core.jar"]
+FROM eclipse-temurin:17-jre-focal
+COPY --from=builder dependencies/ ./
+COPY --from=builder snapshot-dependencies/ ./
+COPY --from=builder spring-boot-loader/ ./
+COPY --from=builder application/ ./
+ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher"]
diff --git a/streampipes-service-core-minimal/pom.xml 
b/streampipes-service-core-minimal/pom.xml
index 4d5df1989..5e8ecde29 100644
--- a/streampipes-service-core-minimal/pom.xml
+++ b/streampipes-service-core-minimal/pom.xml
@@ -74,6 +74,9 @@
                     </execution>
                 </executions>
                 <configuration>
+                    <layers>
+                        <enabled>true</enabled>
+                    </layers>
                     <environmentVariables>
                         <SP_COUCHDB_HOST>localhost</SP_COUCHDB_HOST>
                         <SP_BACKEND_HOST>localhost</SP_BACKEND_HOST>
diff --git a/streampipes-service-core/Dockerfile 
b/streampipes-service-core/Dockerfile
index e4f4faf4e..bfcb099c4 100644
--- a/streampipes-service-core/Dockerfile
+++ b/streampipes-service-core/Dockerfile
@@ -13,8 +13,14 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-FROM eclipse-temurin:17-jre-focal
-
-COPY target/streampipes-core.jar  /streampipes-core.jar
+FROM eclipse-temurin:17-jre-focal as builder
+ARG JAR_FILE=target/streampipes-core.jar
+COPY ${JAR_FILE} application.jar
+RUN java -Djarmode=layertools -jar application.jar extract
 
-ENTRYPOINT ["java", "-jar", "/streampipes-core.jar"]
+FROM eclipse-temurin:17-jre-focal
+COPY --from=builder dependencies/ ./
+COPY --from=builder snapshot-dependencies/ ./
+COPY --from=builder spring-boot-loader/ ./
+COPY --from=builder application/ ./
+ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher"]
diff --git a/streampipes-service-core/pom.xml b/streampipes-service-core/pom.xml
index 72f1b30d6..09023a1d6 100644
--- a/streampipes-service-core/pom.xml
+++ b/streampipes-service-core/pom.xml
@@ -147,6 +147,9 @@
                     </execution>
                 </executions>
                 <configuration>
+                    <layers>
+                        <enabled>true</enabled>
+                    </layers>
                     <environmentVariables>
                         <SP_COUCHDB_HOST>localhost</SP_COUCHDB_HOST>
                         <SP_BACKEND_HOST>localhost</SP_BACKEND_HOST>

Reply via email to