jbonofre commented on code in PR #2839:
URL: https://github.com/apache/karaf/pull/2839#discussion_r3989179290


##########
tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/DockerfileMojo.java:
##########
@@ -40,13 +40,16 @@ public class DockerfileMojo extends MojoSupport {
     @Parameter(defaultValue = "[\"karaf\", \"run\"]")
     private String command;
 
+    @Parameter(defaultValue = "eclipse-temurin:11-jre", property = "image")
+    private String image;
+
     @Override
     public void execute() throws MojoExecutionException, MojoFailureException {
         getLog().info("Creating Dockerfile");
         File dockerFile = new File(destDir, "Dockerfile");
         try {
             StringBuilder buffer = new StringBuilder();
-            buffer.append("FROM eclipse-temurin:11-jre").append("\n");
+            buffer.append("FROM ").append(image).append("\n");

Review Comment:
   Neither `image` nor `command` are validated before being written into the 
Dockerfile. An empty `<image></image>` (or `-Dimage=`) would produce an invalid 
`FROM` line with no argument, and a value containing an embedded newline would 
silently inject extra Dockerfile instructions.
   
   Worth at least falling back to the default when the value is blank.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to