showuon commented on code in PR #23560:
URL: https://github.com/apache/kafka/pull/23560#discussion_r4204274461


##########
docker/README.md:
##########
@@ -130,6 +130,10 @@ python docker_build_test.py kafka/test --image-tag=3.6.0 
--image-type=jvm --kafk
 ```
 python docker_build_test.py kafka/test --image-tag=3.8.0 --image-type=native 
--kafka-url=https://archive.apache.org/dist/kafka/3.8.0/kafka_2.13-3.8.0.tgz
 ```
+- Example(jvm, custom base image) :- The jvm image is built on 
`eclipse-temurin:25-jre-alpine` by default. Any Alpine-based image carrying a 
JRE can be used instead, e.g. to build on a different JDK version, by passing 
`--base-image`
+```
+python docker_build_test.py kafka/test --image-tag=3.6.0 --image-type=jvm 
--base-image=docker.io/library/eclipse-temurin:25-jre-alpine 
--kafka-url=https://archive.apache.org/dist/kafka/3.6.0/kafka_2.13-3.6.0.tgz

Review Comment:
   We already default to `docker.io/library/eclipse-temurin:25-jre-alpine`. 
Maybe this example can demo the custom base image, instead of the default one.



##########
docker/prepare_docker_official_image_source.py:
##########
@@ -49,6 +49,10 @@ def replace_arg_with_env(filedata, arg_name, value):
 def remove_args_and_hardcode_values(file_path, kafka_version, kafka_url):
     with open(file_path, 'r') as file:
         filedata = file.read()
+    # Docker Official Images require literal FROM lines, so inline the default 
base image
+    # and drop the ARG together with the comment explaining how to override it.
+    base_image = re.search(r"^(?:#.*\n)*ARG base_image=(\S+)\n\n", filedata, 
re.MULTILINE)
+    filedata = filedata.replace(base_image.group(0), 
"").replace("${base_image}", base_image.group(1))

Review Comment:
   I think this will cause the maintenance problem. If some future improvement 
accidentally remove the comments, the regex won't match anymore, and it's hard 
to troubleshoot. Could we only match the `ARG base_image` line?



-- 
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