This is an automated email from the ASF dual-hosted git repository.
davsclaus 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 0319f572f6d9 CAMEL-23088: Provide JDK 25 Dockerfile template in jbang
(#21746)
0319f572f6d9 is described below
commit 0319f572f6d9a4e4f6b3905f740561e139d33a78
Author: Guillaume Nodet <[email protected]>
AuthorDate: Sun Mar 8 09:38:36 2026 +0100
CAMEL-23088: Provide JDK 25 Dockerfile template in jbang (#21746)
* CAMEL-23088: Provide JDK 25 Dockerfile template in jbang
Add Dockerfile25.tmpl for JDK 25 using eclipse-temurin:25-jre-ubi9-minimal
base image. The export command now dynamically selects the Dockerfile
template based on the --java-version option, falling back to the JDK 21
template if no matching template is found.
* CAMEL-23088: Regenerate missing generated files
* CAMEL-23088: Support JAVA_OPTS in JDK 25 Dockerfile and warn on fallback
- Use shell form ENTRYPOINT with $JAVA_OPTS expansion in Dockerfile25
- Log a message when falling back to JDK 21 Dockerfile template
Co-Authored-By: Claude Opus 4.6 <[email protected]>
---------
Co-authored-by: Claude Opus 4.6 <[email protected]>
---
.../camel-jbang-dependency-copy.adoc | 2 +-
.../camel-jbang-dependency-list.adoc | 2 +-
.../camel-jbang-dependency-update.adoc | 2 +-
.../pages/jbang-commands/camel-jbang-export.adoc | 2 +-
.../pages/jbang-commands/camel-jbang-sbom.adoc | 2 +-
.../META-INF/camel-jbang-commands-metadata.json | 6 ++--
.../camel/dsl/jbang/core/commands/Export.java | 9 +++--
.../dsl/jbang/core/commands/ExportBaseCommand.java | 2 +-
.../src/main/resources/templates/Dockerfile25.tmpl | 41 ++++++++++++++++++++++
9 files changed, 57 insertions(+), 11 deletions(-)
diff --git
a/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-dependency-copy.adoc
b/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-dependency-copy.adoc
index 9d7b3e80d7d2..6f1f1a236796 100644
---
a/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-dependency-copy.adoc
+++
b/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-dependency-copy.adoc
@@ -33,7 +33,7 @@ camel dependency copy [options]
| `--hawtio` | Whether to include Hawtio web console (only available for
exporting to Spring Boot or Quarkus) | false | boolean
| `--hawtio-version` | Version of the Hawtio web console |
HawtioVersion.HAWTIO_VERSION | String
| `--ignore-loading-error` | Whether to ignore route loading and compilation
errors (use this with care!) | false | boolean
-| `--java-version` | Java version | 21 | String
+| `--java-version` | Java version (21, 25) | 21 | String
| `--kamelets-version` | Apache Camel Kamelets version |
RuntimeType.KAMELETS_VERSION | String
| `--lazy-bean` | Whether to use lazy bean initialization (can help with
complex classloading issues | true | boolean
| `--local-kamelet-dir` | Local directory for loading Kamelets (takes
precedence) | | String
diff --git
a/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-dependency-list.adoc
b/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-dependency-list.adoc
index 2f5bcdbcf93f..f58794bb7dee 100644
---
a/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-dependency-list.adoc
+++
b/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-dependency-list.adoc
@@ -33,7 +33,7 @@ camel dependency list [options]
| `--hawtio` | Whether to include Hawtio web console (only available for
exporting to Spring Boot or Quarkus) | false | boolean
| `--hawtio-version` | Version of the Hawtio web console |
HawtioVersion.HAWTIO_VERSION | String
| `--ignore-loading-error` | Whether to ignore route loading and compilation
errors (use this with care!) | false | boolean
-| `--java-version` | Java version | 21 | String
+| `--java-version` | Java version (21, 25) | 21 | String
| `--kamelets-version` | Apache Camel Kamelets version |
RuntimeType.KAMELETS_VERSION | String
| `--lazy-bean` | Whether to use lazy bean initialization (can help with
complex classloading issues | true | boolean
| `--local-kamelet-dir` | Local directory for loading Kamelets (takes
precedence) | | String
diff --git
a/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-dependency-update.adoc
b/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-dependency-update.adoc
index f90aa9e28f13..210d7a7d6645 100644
---
a/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-dependency-update.adoc
+++
b/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-dependency-update.adoc
@@ -34,7 +34,7 @@ camel dependency update [options]
| `--hawtio` | Whether to include Hawtio web console (only available for
exporting to Spring Boot or Quarkus) | false | boolean
| `--hawtio-version` | Version of the Hawtio web console |
HawtioVersion.HAWTIO_VERSION | String
| `--ignore-loading-error` | Whether to ignore route loading and compilation
errors (use this with care!) | false | boolean
-| `--java-version` | Java version | 21 | String
+| `--java-version` | Java version (21, 25) | 21 | String
| `--kamelets-version` | Apache Camel Kamelets version |
RuntimeType.KAMELETS_VERSION | String
| `--lazy-bean` | Whether to use lazy bean initialization (can help with
complex classloading issues | true | boolean
| `--local-kamelet-dir` | Local directory for loading Kamelets (takes
precedence) | | String
diff --git
a/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-export.adoc
b/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-export.adoc
index 516845c858c7..46aac4321250 100644
--- a/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-export.adoc
+++ b/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-export.adoc
@@ -33,7 +33,7 @@ camel export [options]
| `--hawtio` | Whether to include Hawtio web console (only available for
exporting to Spring Boot or Quarkus) | false | boolean
| `--hawtio-version` | Version of the Hawtio web console |
HawtioVersion.HAWTIO_VERSION | String
| `--ignore-loading-error` | Whether to ignore route loading and compilation
errors (use this with care!) | false | boolean
-| `--java-version` | Java version | 21 | String
+| `--java-version` | Java version (21, 25) | 21 | String
| `--kamelets-version` | Apache Camel Kamelets version |
RuntimeType.KAMELETS_VERSION | String
| `--lazy-bean` | Whether to use lazy bean initialization (can help with
complex classloading issues | true | boolean
| `--local-kamelet-dir` | Local directory for loading Kamelets (takes
precedence) | | String
diff --git
a/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-sbom.adoc
b/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-sbom.adoc
index bb869a20c6bc..4d16b265fb4c 100644
--- a/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-sbom.adoc
+++ b/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-sbom.adoc
@@ -34,7 +34,7 @@ camel sbom [options]
| `--hawtio` | Whether to include Hawtio web console (only available for
exporting to Spring Boot or Quarkus) | false | boolean
| `--hawtio-version` | Version of the Hawtio web console |
HawtioVersion.HAWTIO_VERSION | String
| `--ignore-loading-error` | Whether to ignore route loading and compilation
errors (use this with care!) | false | boolean
-| `--java-version` | Java version | 21 | String
+| `--java-version` | Java version (21, 25) | 21 | String
| `--kamelets-version` | Apache Camel Kamelets version |
RuntimeType.KAMELETS_VERSION | String
| `--lazy-bean` | Whether to use lazy bean initialization (can help with
complex classloading issues | true | boolean
| `--local-kamelet-dir` | Local directory for loading Kamelets (takes
precedence) | | String
diff --git
a/dsl/camel-jbang/camel-jbang-core/src/generated/resources/META-INF/camel-jbang-commands-metadata.json
b/dsl/camel-jbang/camel-jbang-core/src/generated/resources/META-INF/camel-jbang-commands-metadata.json
index 2a04a11bd0ed..98bf97804a90 100644
---
a/dsl/camel-jbang/camel-jbang-core/src/generated/resources/META-INF/camel-jbang-commands-metadata.json
+++
b/dsl/camel-jbang/camel-jbang-core/src/generated/resources/META-INF/camel-jbang-commands-metadata.json
@@ -6,12 +6,12 @@
{ "name": "completion", "fullName": "completion", "description": "Generate
completion script for bash\/zsh", "sourceClass":
"org.apache.camel.dsl.jbang.core.commands.Complete", "options": [ { "names":
"-h,--help", "description": "Display the help and sub-commands", "javaType":
"boolean", "type": "boolean" } ] },
{ "name": "config", "fullName": "config", "description": "Get and set user
configuration values", "sourceClass":
"org.apache.camel.dsl.jbang.core.commands.config.ConfigCommand", "options": [ {
"names": "-h,--help", "description": "Display the help and sub-commands",
"javaType": "boolean", "type": "boolean" } ], "subcommands": [ { "name": "get",
"fullName": "config get", "description": "Display user configuration value",
"sourceClass": "org.apache.camel.dsl.jbang.core.commands.config. [...]
{ "name": "debug", "fullName": "debug", "description": "Debug local Camel
integration", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.Debug",
"options": [ { "names": "--ago", "description": "Use ago instead of yyyy-MM-dd
HH:mm:ss in timestamp.", "javaType": "boolean", "type": "boolean" }, { "names":
"--background", "description": "Run in the background", "defaultValue":
"false", "javaType": "boolean", "type": "boolean" }, { "names":
"--background-wait", "description": "To [...]
- { "name": "dependency", "fullName": "dependency", "description": "Displays
all Camel dependencies required to run", "sourceClass":
"org.apache.camel.dsl.jbang.core.commands.DependencyCommand", "options": [ {
"names": "-h,--help", "description": "Display the help and sub-commands",
"javaType": "boolean", "type": "boolean" } ], "subcommands": [ { "name":
"copy", "fullName": "dependency copy", "description": "Copies all Camel
dependencies required to run to a specific directory", "sourc [...]
+ { "name": "dependency", "fullName": "dependency", "description": "Displays
all Camel dependencies required to run", "sourceClass":
"org.apache.camel.dsl.jbang.core.commands.DependencyCommand", "options": [ {
"names": "-h,--help", "description": "Display the help and sub-commands",
"javaType": "boolean", "type": "boolean" } ], "subcommands": [ { "name":
"copy", "fullName": "dependency copy", "description": "Copies all Camel
dependencies required to run to a specific directory", "sourc [...]
{ "name": "dirty", "fullName": "dirty", "description": "Check if there are
dirty files from previous Camel runs that did not terminate gracefully",
"sourceClass": "org.apache.camel.dsl.jbang.core.commands.process.Dirty",
"options": [ { "names": "--clean", "description": "Clean dirty files which are
no longer in use", "defaultValue": "false", "javaType": "boolean", "type":
"boolean" }, { "names": "-h,--help", "description": "Display the help and
sub-commands", "javaType": "boolean", " [...]
{ "name": "doc", "fullName": "doc", "description": "Shows documentation
for kamelet, component, and other Camel resources", "sourceClass":
"org.apache.camel.dsl.jbang.core.commands.catalog.CatalogDoc", "options": [ {
"names": "--camel-version", "description": "To use a different Camel version
than the default version", "javaType": "java.lang.String", "type": "string" },
{ "names": "--download", "description": "Whether to allow automatic downloading
JAR dependencies (over the internet [...]
{ "name": "eval", "fullName": "eval", "description": "Evaluate Camel
expressions and scripts", "sourceClass":
"org.apache.camel.dsl.jbang.core.commands.EvalCommand", "options": [ { "names":
"-h,--help", "description": "Display the help and sub-commands", "javaType":
"boolean", "type": "boolean" } ], "subcommands": [ { "name": "expression",
"fullName": "eval expression", "description": "Evaluates Camel expression",
"sourceClass": "org.apache.camel.dsl.jbang.core.commands.action.EvalEx [...]
{ "name": "explain", "fullName": "explain", "description": "Explain what a
Camel route does using AI\/LLM", "sourceClass":
"org.apache.camel.dsl.jbang.core.commands.Explain", "options": [ { "names":
"--api-key", "description": "API key for authentication. Also reads
OPENAI_API_KEY or LLM_API_KEY env vars", "javaType": "java.lang.String",
"type": "string" }, { "names": "--api-type", "description": "API type: 'ollama'
or 'openai' (OpenAI-compatible)", "defaultValue": "ollama", "javaTyp [...]
- { "name": "export", "fullName": "export", "description": "Export to other
runtimes (Camel Main, Spring Boot, or Quarkus)", "sourceClass":
"org.apache.camel.dsl.jbang.core.commands.Export", "options": [ { "names":
"--build-property", "description": "Maven build properties, ex.
--build-property=prop1=foo", "javaType": "java.util.List", "type": "array" }, {
"names": "--camel-spring-boot-version", "description": "Camel version to use
with Spring Boot", "javaType": "java.lang.String", "ty [...]
+ { "name": "export", "fullName": "export", "description": "Export to other
runtimes (Camel Main, Spring Boot, or Quarkus)", "sourceClass":
"org.apache.camel.dsl.jbang.core.commands.Export", "options": [ { "names":
"--build-property", "description": "Maven build properties, ex.
--build-property=prop1=foo", "javaType": "java.util.List", "type": "array" }, {
"names": "--camel-spring-boot-version", "description": "Camel version to use
with Spring Boot", "javaType": "java.lang.String", "ty [...]
{ "name": "get", "fullName": "get", "description": "Get status of Camel
integrations", "sourceClass":
"org.apache.camel.dsl.jbang.core.commands.process.CamelStatus", "options": [ {
"names": "--watch", "description": "Execute periodically and showing output
fullscreen", "javaType": "boolean", "type": "boolean" }, { "names":
"-h,--help", "description": "Display the help and sub-commands", "javaType":
"boolean", "type": "boolean" } ], "subcommands": [ { "name": "bean",
"fullName": "get [...]
{ "name": "harden", "fullName": "harden", "description": "Suggest security
hardening for Camel routes using AI\/LLM", "sourceClass":
"org.apache.camel.dsl.jbang.core.commands.Harden", "options": [ { "names":
"--api-key", "description": "API key for authentication. Also reads
OPENAI_API_KEY or LLM_API_KEY env vars", "javaType": "java.lang.String",
"type": "string" }, { "names": "--api-type", "description": "API type: 'ollama'
or 'openai' (OpenAI-compatible)", "defaultValue": "ollama", [...]
{ "name": "hawtio", "fullName": "hawtio", "description": "Launch Hawtio
web console", "sourceClass":
"org.apache.camel.dsl.jbang.core.commands.process.Hawtio", "options": [ {
"names": "--openUrl", "description": "To automatic open Hawtio web console in
the web browser", "defaultValue": "true", "javaType": "boolean", "type":
"boolean" }, { "names": "--port", "description": "Port number to use for Hawtio
web console (port 8888 by default)", "defaultValue": "8888", "javaType": "int",
"t [...]
@@ -23,7 +23,7 @@
{ "name": "plugin", "fullName": "plugin", "description": "Manage plugins
that add sub-commands to this CLI", "sourceClass":
"org.apache.camel.dsl.jbang.core.commands.plugin.PluginCommand", "options": [ {
"names": "-h,--help", "description": "Display the help and sub-commands",
"javaType": "boolean", "type": "boolean" } ], "subcommands": [ { "name": "add",
"fullName": "plugin add", "description": "Add new plugin", "sourceClass":
"org.apache.camel.dsl.jbang.core.commands.plugin.PluginA [...]
{ "name": "ps", "fullName": "ps", "description": "List running Camel
integrations", "sourceClass":
"org.apache.camel.dsl.jbang.core.commands.process.ListProcess", "options": [ {
"names": "--json", "description": "Output in JSON Format", "javaType":
"boolean", "type": "boolean" }, { "names": "--pid", "description": "List only
pid in the output", "javaType": "boolean", "type": "boolean" }, { "names":
"--remote", "description": "Break down counters into remote\/total pairs",
"javaType": [...]
{ "name": "run", "fullName": "run", "description": "Run as local Camel
integration", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.Run",
"options": [ { "names": "--background", "description": "Run in the background",
"defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names":
"--background-wait", "description": "To wait for run in background to startup
successfully, before returning", "defaultValue": "true", "javaType": "boolean",
"type": "boolean" }, { [...]
- { "name": "sbom", "fullName": "sbom", "description": "Generate a CycloneDX
or SPDX SBOM for a specific project", "sourceClass":
"org.apache.camel.dsl.jbang.core.commands.SBOMGenerator", "options": [ {
"names": "--build-property", "description": "Maven build properties, ex.
--build-property=prop1=foo", "javaType": "java.util.List", "type": "array" }, {
"names": "--camel-spring-boot-version", "description": "Camel version to use
with Spring Boot", "javaType": "java.lang.String", "type" [...]
+ { "name": "sbom", "fullName": "sbom", "description": "Generate a CycloneDX
or SPDX SBOM for a specific project", "sourceClass":
"org.apache.camel.dsl.jbang.core.commands.SBOMGenerator", "options": [ {
"names": "--build-property", "description": "Maven build properties, ex.
--build-property=prop1=foo", "javaType": "java.util.List", "type": "array" }, {
"names": "--camel-spring-boot-version", "description": "Camel version to use
with Spring Boot", "javaType": "java.lang.String", "type" [...]
{ "name": "script", "fullName": "script", "description": "Run Camel
integration as shell script for terminal scripting", "sourceClass":
"org.apache.camel.dsl.jbang.core.commands.Script", "options": [ { "names":
"--logging", "description": "Can be used to turn on logging (logs to file in
<user home>\/.camel directory)", "defaultValue": "false", "javaType":
"boolean", "type": "boolean" }, { "names": "--logging-level", "description":
"Logging level ()", "defaultValue": "info", "javaType [...]
{ "name": "shell", "fullName": "shell", "description": "Interactive Camel
JBang shell.", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.Shell",
"options": [ { "names": "-h,--help", "description": "Display the help and
sub-commands", "javaType": "boolean", "type": "boolean" } ] },
{ "name": "stop", "fullName": "stop", "description": "Shuts down running
Camel integrations", "sourceClass":
"org.apache.camel.dsl.jbang.core.commands.process.StopProcess", "options": [ {
"names": "--kill", "description": "To force killing the process (SIGKILL)",
"javaType": "boolean", "type": "boolean" }, { "names": "-h,--help",
"description": "Display the help and sub-commands", "javaType": "boolean",
"type": "boolean" } ] },
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 8b63fe340bc6..3f3c7064ea5d 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
@@ -368,8 +368,13 @@ public class Export extends ExportBaseCommand {
Path docker = Path.of(buildDir).resolve("src/main/docker");
Files.createDirectories(docker);
String[] ids = gav.split(":");
- InputStream is
- =
ExportCamelMain.class.getClassLoader().getResourceAsStream("templates/Dockerfile21.tmpl");
+ String templateName = "templates/Dockerfile" + javaVersion + ".tmpl";
+ InputStream is =
ExportCamelMain.class.getClassLoader().getResourceAsStream(templateName);
+ if (is == null) {
+ // fallback to JDK 21 template
+ printer().printf("No Dockerfile template for Java %s, falling back
to Java 21 template%n", javaVersion);
+ is =
ExportCamelMain.class.getClassLoader().getResourceAsStream("templates/Dockerfile21.tmpl");
+ }
String context = IOHelper.loadText(is);
IOHelper.close(is);
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 261bf91a6b8f..fececf919062 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
@@ -160,7 +160,7 @@ public abstract class ExportBaseCommand extends
CamelCommand {
defaultValue = "CamelApplication")
protected String mainClassname = "CamelApplication";
- @CommandLine.Option(names = { "--java-version" }, description = "Java
version", defaultValue = "21")
+ @CommandLine.Option(names = { "--java-version" }, description = "Java
version (21, 25)", defaultValue = "21")
protected String javaVersion = "21";
@CommandLine.Option(names = { "--camel-version" },
diff --git
a/dsl/camel-jbang/camel-jbang-core/src/main/resources/templates/Dockerfile25.tmpl
b/dsl/camel-jbang/camel-jbang-core/src/main/resources/templates/Dockerfile25.tmpl
new file mode 100644
index 000000000000..cc5ff1d27de7
--- /dev/null
+++
b/dsl/camel-jbang/camel-jbang-core/src/main/resources/templates/Dockerfile25.tmpl
@@ -0,0 +1,41 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+####
+# This Dockerfile is used in order to build a container that runs the Camel
application
+#
+# ./mvnw clean package
+# docker build -f src/main/docker/Dockerfile -t {{ .ArtifactId }}:{{ .Version
}} .
+# docker run -it {{ .ArtifactId }}:{{ .Version }}
+#
+###
+FROM eclipse-temurin:25-jre-ubi9-minimal
+
+ENV LANGUAGE='en_US:en'
+
+RUN mkdir /deployments
+
+COPY --chown=185 target/{{ .AppJar }} /deployments/
+
+# Uncomment to expose any given port
+# EXPOSE 8080
+USER 185
+# Uncomment to provide any Java option
+# ENV JAVA_OPTS=""
+WORKDIR /deployments
+
+ENTRYPOINT exec java $JAVA_OPTS -jar {{ .AppJar }}