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

gnodet pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new d0e14d8b58ce CAMEL-23192: Adds missing Quarkus Dockerfiles and 
--quarkus-package-type option
d0e14d8b58ce is described below

commit d0e14d8b58ce3dc75c7e1b09c647dea79f0d209d
Author: Marco Carletti <[email protected]>
AuthorDate: Tue Mar 24 08:29:32 2026 +0100

    CAMEL-23192: Adds missing Quarkus Dockerfiles and --quarkus-package-type 
option
    
    - Add --quarkus-package-type CLI option (uber-jar default, fast-jar 
optional)
    - Add Dockerfile.jvm for fast-jar mode, Dockerfile.native-micro for native 
builds
    - Update Dockerfile.native base image to UBI 9.7
    - Set quarkus.package.jar.type in generated POM based on package type 
selection
---
 .../camel/dsl/jbang/core/commands/Export.java      |  1 +
 .../dsl/jbang/core/commands/ExportBaseCommand.java |  5 ++++
 .../dsl/jbang/core/commands/ExportQuarkus.java     | 33 +++++++++++++++++----
 .../{Dockerfile.native => Dockerfile.jvm}          | 34 ++++++++++++----------
 .../resources/quarkus-docker/Dockerfile.native     |  4 +--
 .../{Dockerfile.native => Dockerfile.native-micro} | 15 ++++++----
 .../src/main/resources/templates/quarkus-pom.tmpl  |  1 +
 7 files changed, 63 insertions(+), 30 deletions(-)

diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Export.java
 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Export.java
index 463dcdd9efe3..6deae48e4ea8 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Export.java
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Export.java
@@ -243,6 +243,7 @@ public class Export extends ExportBaseCommand {
         cmd.quarkusGroupId = this.quarkusGroupId;
         cmd.quarkusArtifactId = this.quarkusArtifactId;
         cmd.quarkusVersion = this.quarkusVersion;
+        cmd.quarkusPackageType = this.quarkusPackageType;
         cmd.springBootVersion = this.springBootVersion;
         cmd.mavenWrapper = this.mavenWrapper;
         cmd.quiet = this.quiet;
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ExportBaseCommand.java
 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ExportBaseCommand.java
index 72f2b6206e10..24ccf486aa70 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ExportBaseCommand.java
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ExportBaseCommand.java
@@ -205,6 +205,11 @@ public abstract class ExportBaseCommand extends 
CamelCommand {
                         defaultValue = RuntimeType.QUARKUS_VERSION)
     protected String quarkusVersion = RuntimeType.QUARKUS_VERSION;
 
+    @CommandLine.Option(names = { "--quarkus-package-type" },
+                        description = "Quarkus package type (uber-jar or 
fast-jar)",
+                        defaultValue = "uber-jar")
+    protected String quarkusPackageType = "uber-jar";
+
     @CommandLine.Option(names = { "--maven-wrapper" }, defaultValue = "true",
                         description = "Include Maven Wrapper files in exported 
project")
     protected boolean mavenWrapper = true;
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ExportQuarkus.java
 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ExportQuarkus.java
index 959b0af739d2..9b58bf18dad8 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ExportQuarkus.java
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ExportQuarkus.java
@@ -129,7 +129,12 @@ class ExportQuarkus extends Export {
         });
         // copy docker files
         copyDockerFiles(BUILD_DIR);
-        String appJar = "target" + File.separator + "quarkus-app" + 
File.separator + "quarkus-run.jar";
+        String appJar;
+        if ("fast-jar".equals(quarkusPackageType)) {
+            appJar = "target" + File.separator + "quarkus-app" + 
File.separator + "quarkus-run.jar";
+        } else {
+            appJar = "target" + File.separator + ids[1] + "-" + ids[2] + 
".jar";
+        }
         copyReadme(BUILD_DIR, appJar);
         // gather dependencies
         Set<String> deps = resolveDependencies(settings, profile);
@@ -282,12 +287,27 @@ class ExportQuarkus extends Export {
 
     @Override
     protected void copyDockerFiles(String buildDir) throws Exception {
-        super.copyDockerFiles(buildDir);
+        if ("uber-jar".equals(quarkusPackageType)) {
+            // For uber-jar, the generic Dockerfile works as-is
+            super.copyDockerFiles(buildDir);
+        } else {
+            // For fast-jar, use a Quarkus-specific JVM Dockerfile
+            Path docker = Path.of(buildDir).resolve("src/main/docker");
+            Files.createDirectories(docker);
+            InputStream is
+                    = 
ExportQuarkus.class.getClassLoader().getResourceAsStream("quarkus-docker/Dockerfile.jvm");
+            if (is != null) {
+                PathUtils.copyFromStream(is, docker.resolve("Dockerfile"), 
true);
+            }
+        }
+        // Quarkus-specific Dockerfiles for native builds
         Path docker = Path.of(buildDir).resolve("src/main/docker");
-        Files.createDirectories(docker);
-        // copy files
-        InputStream is = 
ExportQuarkus.class.getClassLoader().getResourceAsStream("quarkus-docker/Dockerfile.native");
-        PathUtils.copyFromStream(is, docker.resolve("Dockerfile.native"), 
true);
+        for (String dockerfile : List.of("Dockerfile.native", 
"Dockerfile.native-micro")) {
+            InputStream is = 
ExportQuarkus.class.getClassLoader().getResourceAsStream("quarkus-docker/" + 
dockerfile);
+            if (is != null) {
+                PathUtils.copyFromStream(is, docker.resolve(dockerfile), true);
+            }
+        }
     }
 
     @Override
@@ -331,6 +351,7 @@ class ExportQuarkus extends Export {
         context = context.replaceAll("\\{\\{ \\.QuarkusGroupId }}", 
quarkusGroupId);
         context = context.replaceAll("\\{\\{ \\.QuarkusArtifactId }}", 
quarkusArtifactId);
         context = context.replaceAll("\\{\\{ \\.QuarkusVersion }}", 
quarkusVersion);
+        context = context.replaceAll("\\{\\{ \\.QuarkusPackageType }}", 
quarkusPackageType);
         context = context.replaceAll("\\{\\{ \\.QuarkusManagementPort }}", mp);
         context = context.replaceAll("\\{\\{ \\.JavaVersion }}", javaVersion);
         context = context.replaceAll("\\{\\{ \\.CamelVersion }}", 
camelVersion);
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/main/resources/quarkus-docker/Dockerfile.native
 
b/dsl/camel-jbang/camel-jbang-core/src/main/resources/quarkus-docker/Dockerfile.jvm
similarity index 54%
copy from 
dsl/camel-jbang/camel-jbang-core/src/main/resources/quarkus-docker/Dockerfile.native
copy to 
dsl/camel-jbang/camel-jbang-core/src/main/resources/quarkus-docker/Dockerfile.jvm
index b4d920348926..e3204cf0719d 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/main/resources/quarkus-docker/Dockerfile.native
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/main/resources/quarkus-docker/Dockerfile.jvm
@@ -16,34 +16,36 @@
 #
 
 ####
-# This Dockerfile is used in order to build a container that runs the Quarkus 
application in Native mode.
+# This Dockerfile is used in order to build a container that runs the Quarkus 
application in JVM mode
+# using the fast-jar packaging.
 #
 # Before building the container image run:
 #
-# ./mvnw package -Dnative
+# ./mvnw clean package
 #
 # Then, build the image with:
 #
-# docker build -f src/main/docker/Dockerfile.native -t 
quarkus/code-with-quarkus .
+# docker build -f src/main/docker/Dockerfile -t quarkus/camel-app .
 #
 # Then run the container using:
 #
-# docker run -i quarkus/code-with-quarkus
+# docker run -i --rm -p 8080:8080 quarkus/camel-app
 #
-# The ` registry.access.redhat.com/ubi9/ubi-minimal:9.5` base image is based 
on UBI 9.
-# To use UBI 8, switch to `quay.io/ubi8/ubi-minimal:8.10`.
 ###
-FROM registry.access.redhat.com/ubi9/ubi-minimal:9.6
-WORKDIR /work/
-RUN chown 1001 /work \
-    && chmod "g+rwX" /work \
-    && chown 1001:root /work
-COPY --chown=1001:root --chmod=0755 target/*-runner /work/application
+FROM registry.access.redhat.com/ubi9/openjdk-21:1.23
+
+ENV LANGUAGE='en_US:en'
+
+# We make four distinct layers so if there are application changes the library 
layers can be re-used
+COPY --chown=185 target/quarkus-app/lib/ /deployments/lib/
+COPY --chown=185 target/quarkus-app/*.jar /deployments/
+COPY --chown=185 target/quarkus-app/app/ /deployments/app/
+COPY --chown=185 target/quarkus-app/quarkus/ /deployments/quarkus/
 
 # Uncomment to expose any given port
 # EXPOSE 8080
-USER 1001
+USER 185
+ENV JAVA_OPTS_APPEND="-Dquarkus.http.host=0.0.0.0 
-Djava.util.logging.manager=org.jboss.logmanager.LogManager"
+ENV JAVA_APP_JAR="/deployments/quarkus-run.jar"
 
-# Use this if you're exposing some port
-# ENTRYPOINT ["./application", "-Dquarkus.http.host=0.0.0.0"]
-ENTRYPOINT ["./application"]
+ENTRYPOINT [ "/opt/jboss/container/java/run/run-java.sh" ]
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/main/resources/quarkus-docker/Dockerfile.native
 
b/dsl/camel-jbang/camel-jbang-core/src/main/resources/quarkus-docker/Dockerfile.native
index b4d920348926..8771b0fb2152 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/main/resources/quarkus-docker/Dockerfile.native
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/main/resources/quarkus-docker/Dockerfile.native
@@ -30,10 +30,10 @@
 #
 # docker run -i quarkus/code-with-quarkus
 #
-# The ` registry.access.redhat.com/ubi9/ubi-minimal:9.5` base image is based 
on UBI 9.
+# The ` registry.access.redhat.com/ubi9/ubi-minimal:9.7` base image is based 
on UBI 9.
 # To use UBI 8, switch to `quay.io/ubi8/ubi-minimal:8.10`.
 ###
-FROM registry.access.redhat.com/ubi9/ubi-minimal:9.6
+FROM registry.access.redhat.com/ubi9/ubi-minimal:9.7
 WORKDIR /work/
 RUN chown 1001 /work \
     && chmod "g+rwX" /work \
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/main/resources/quarkus-docker/Dockerfile.native
 
b/dsl/camel-jbang/camel-jbang-core/src/main/resources/quarkus-docker/Dockerfile.native-micro
similarity index 68%
copy from 
dsl/camel-jbang/camel-jbang-core/src/main/resources/quarkus-docker/Dockerfile.native
copy to 
dsl/camel-jbang/camel-jbang-core/src/main/resources/quarkus-docker/Dockerfile.native-micro
index b4d920348926..12568be5f61a 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/main/resources/quarkus-docker/Dockerfile.native
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/main/resources/quarkus-docker/Dockerfile.native-micro
@@ -16,7 +16,10 @@
 #
 
 ####
-# This Dockerfile is used in order to build a container that runs the Quarkus 
application in Native mode.
+# This Dockerfile is used in order to build a container that runs the Quarkus 
application in native (no JVM) mode.
+# It uses a micro base image, tuned for Quarkus native executables.
+# It reduces the size of the resulting container image.
+# Check https://quarkus.io/guides/quarkus-runtime-base-image for further 
information about this image.
 #
 # Before building the container image run:
 #
@@ -24,16 +27,16 @@
 #
 # Then, build the image with:
 #
-# docker build -f src/main/docker/Dockerfile.native -t 
quarkus/code-with-quarkus .
+# docker build -f src/main/docker/Dockerfile.native-micro -t 
quarkus/code-with-quarkus .
 #
 # Then run the container using:
 #
-# docker run -i quarkus/code-with-quarkus
+# docker run -i --rm -p 8080:8080 quarkus/code-with-quarkus
 #
-# The ` registry.access.redhat.com/ubi9/ubi-minimal:9.5` base image is based 
on UBI 9.
-# To use UBI 8, switch to `quay.io/ubi8/ubi-minimal:8.10`.
+# The `quay.io/quarkus/ubi9-quarkus-micro-image:2.0` base image is based on 
UBI 9.
+# To use UBI 8, switch to `quay.io/quarkus/quarkus-micro-image:2.0`.
 ###
-FROM registry.access.redhat.com/ubi9/ubi-minimal:9.6
+FROM quay.io/quarkus/ubi9-quarkus-micro-image:2.0
 WORKDIR /work/
 RUN chown 1001 /work \
     && chmod "g+rwX" /work \
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/main/resources/templates/quarkus-pom.tmpl
 
b/dsl/camel-jbang/camel-jbang-core/src/main/resources/templates/quarkus-pom.tmpl
index 09f7edd78346..bdd439a8c35f 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/main/resources/templates/quarkus-pom.tmpl
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/main/resources/templates/quarkus-pom.tmpl
@@ -18,6 +18,7 @@
         <quarkus.platform.artifact-id>{{ .QuarkusArtifactId 
}}</quarkus.platform.artifact-id>
         <quarkus.platform.version>{{ .QuarkusVersion 
}}</quarkus.platform.version>
 {{ .BuildProperties }}
+        <quarkus.package.jar.type>{{ .QuarkusPackageType 
}}</quarkus.package.jar.type>
         <skipITs>true</skipITs>
         <surefire-plugin.version>3.5.5</surefire-plugin.version>
     </properties>

Reply via email to