This directory contains:
jvm
based and graalvm based native
kafkabranch
.Make sure the DOCKERHUB_USER
and DOCKERHUB_TOKEN
secrets are added and made available to Github Actions in Github Repository settings. This is required for pushing the docker image.
This is the recommended way to build, test and get a CVE report for the docker image.
Just choose the image type and provide kafka url to Docker Build Test
workflow. It will generate a test report and CVE report that can be shared with the community.
kafka-url - This is the url to download kafka tarball from. For example kafka tarball url from Kafka archive. For building RC image this will be an RC tarball url.
image-type - This is the type of image that we intend to build. This will be dropdown menu type selection in the workflow.
jvm
image type is for official docker image (to be hosted on apache/kafka) as described in KIP-975native
image type is for graalvm based native
Kafka docker image (to be hosted on apache/kafka-native) as described in KIP-974. Or you can see native/README.md for more information.Example(jvm):- To build and test a jvm image type ensuring kafka to be containerised should be https://archive.apache.org/dist/kafka/3.6.0/kafka_2.13-3.6.0.tgz (it is recommended to use scala 2.13 binary tarball), following inputs in github actions workflow are recommended.
image_type: jvm
kafka_url: https://archive.apache.org/dist/kafka/3.6.0/kafka_2.13-3.6.0.tgz
image_type: native
kafka_url: https://archive.apache.org/dist/kafka/3.8.0/kafka_2.13-3.8.0.tgz
Build and Push Release Candidate Docker Image
Github Actions Workflow.image_type
and provide kafka_url
that needs to be containerised in the rc_docker_image
that will be pushed to github.image_type: jvm
kafka_url: https://archive.apache.org/dist/kafka/3.6.0/kafka_2.13-3.6.0.tgz
rc_docker_image: apache/kafka:3.6.0-rc0
image_type: native
kafka_url: https://archive.apache.org/dist/kafka/3.8.0/kafka_2.13-3.8.0.tgz
rc_docker_image: apache/kafka-native:3.8.0-rc0
Promote Release Candidate Docker Image
Github Actions Workflow.rc_docker_image
) that you want to promote and where it needs to be pushed to (promoted_docker_image
), i.e. the final docker image release.rc_docker_image: apache/kafka:3.6.0-rc0
promoted_docker_image: apache/kafka:3.6.0
rc_docker_image: apache/kafka-native:3.8.0-rc0
promoted_docker_image: apache/kafka-native:3.8.0
Docker Image CVE Scanner
Github Action Workflow (present in .github/workflows/docker_scan.yml
) will run nightly CVE scans and generate reports for docker image tags mentioned in the supported_image_tag
array.For supporting apache/kafka:3.6.0, apache/kafka:latest and apache/kafka:3.7.0-rc0, supported_image_tag array should be
supported_image_tag: ['3.6.0', 'latest', '3.7.0-rc0']
For supporting apache/kafka:3.6.1, apache/kafka:latest and apache/kafka:3.7.0-rc1, tag array should be
supported_image_tag: ['3.6.1', 'latest', '3.7.0-rc1']
Make sure you have python (>= 3.7.x) and java (>= 17) (java needed only for running tests) installed before running the tests and scripts.
Run pip install -r requirements.txt
to get all the requirements for running the scripts.
Make sure you have docker installed with support for buildx enabled. (For pushing multi-architecture image to docker registry)
docker_build_test.py
script builds and tests the docker image.python docker_build_test.py --help
.--build
(or -b
) flag and if you only want to test the given image pass --test
(or -t
) flag.python docker_build_test.py kafka/test --image-tag=3.6.0 --image-type=jvm --kafka-url=https://archive.apache.org/dist/kafka/3.6.0/kafka_2.13-3.6.0.tgz
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
docker_release.py
script builds a multi-architecture image and pushes it to provided docker registry.<registry>/<namespace>/<image_name>:<image_tag>
) and type is needed to build the image. For detailed usage description check python docker_release.py --help
.# kafka/test is an example repo. Please replace with the docker hub repo you have push access to.
python docker_release.py kafka/test:3.6.0 --image-type=jvm --kafka-url=https://archive.apache.org/dist/kafka/3.6.0/kafka_2.13-3.6.0.tgz
# kafka-native/test is an example repo. Please replace with the docker hub repo you have push access to.
python docker_release.py kafka-native/test:3.8.0 --image-type=native --kafka-url=https://archive.apache.org/dist/kafka/3.8.0/kafka_2.13-3.8.0.tgz
# Ensure docker buildx is enabled in your system and you have access to apache/kafka
docker buildx imagetools create --tag apache/kafka:3.6.0 apache/kafka:3.6.0-rc0
# Ensure docker buildx is enabled in your system and you have access to apache/kafka-native
docker buildx imagetools create --tag apache/kafka-native:3.8.0 apache/kafka-native:3.8.0-rc0
Please check this for usage guide of the docker image.
This is the recommended way to release docker official image.
Ensure these steps are being run for a particular version, only once the AK release process for that version has been completed.
Provide the image type and kafka version to Docker Prepare Docker Official Image Source
workflow. It will generate a artifact containing the static Dockerfile and assets for that specific version. Download the same from the workflow.
image_type: jvm
kafka_version: 3.7.0
docker/extract_docker_official_image_artifact.py
script, by providing it the path to the downloaded artifact. This will create a new directory under docker/docker_official_images/kafka_version
.python extract_docker_official_image_artifact.py --path_to_downloaded_artifact=path/to/downloaded/artifact
If there any versions for which Docker Official Images should not be supported, remove the corresponding directories under docker/docker_official_images
.
Commit these changes to AK trunk.
Provide the image type and kafka version to Docker Official Image Build Test
workflow. It will generate a test report and CVE report that can be shared with the community.
image_type: jvm
kafka_version: 3.7.0
docker/generate_kafka_pr_template.py
script from trunk, by providing it the image type. Update the existing entry, and raise a new PR in Docker Hub's Docker Official Repo by using this new PR template.python generate_kafka_pr_template.py --image-type=jvm
jvm
image type is for official docker image (to be hosted on apache/kafka) as described in KIP-975.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。