-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: switch to multi-arch compatible docker images
- use "official" zookeeper image from library - build a minimal kafka image on-the-fly for the current arch
- Loading branch information
Showing
3 changed files
with
111 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
FROM registry.access.redhat.com/ubi8/ubi-minimal:latest | ||
|
||
USER root | ||
|
||
RUN microdnf update \ | ||
&& microdnf install curl gzip java-11-openjdk-headless tar \ | ||
&& microdnf clean all | ||
|
||
ENV JAVA_HOME=/usr/lib/jvm/jre-11 | ||
|
||
# https://docs.oracle.com/javase/7/docs/technotes/guides/net/properties.html | ||
# Ensure Java doesn't cache any dns results | ||
RUN cd /etc/java/java-11-openjdk/*/conf/security \ | ||
&& sed -e '/networkaddress.cache.ttl/d' -e '/networkaddress.cache.negative.ttl/d' -i java.security \ | ||
&& echo 'networkaddress.cache.ttl=0' >> java.security \ | ||
&& echo 'networkaddress.cache.negative.ttl=0' >> java.security | ||
|
||
# https://github.com/apache/kafka/blob/0d518aaed158896ee9ee6949b8f38128d1d73634/tests/docker/Dockerfile#L65-L67 | ||
ARG KAFKA_MIRROR="https://s3-us-west-2.amazonaws.com/kafka-packages" | ||
RUN mkdir -p "/opt/kafka-2.8.1" && chmod a+rw /opt/kafka-2.8.1 && curl -s "$KAFKA_MIRROR/kafka_2.12-2.8.1.tgz" | tar xz --strip-components=1 -C "/opt/kafka-2.8.1" | ||
RUN mkdir -p "/opt/kafka-3.0.1" && chmod a+rw /opt/kafka-3.0.1 && curl -s "$KAFKA_MIRROR/kafka_2.12-3.0.1.tgz" | tar xz --strip-components=1 -C "/opt/kafka-3.0.1" | ||
RUN mkdir -p "/opt/kafka-3.1.0" && chmod a+rw /opt/kafka-3.1.0 && curl -s "$KAFKA_MIRROR/kafka_2.12-3.1.0.tgz" | tar xz --strip-components=1 -C "/opt/kafka-3.1.0" | ||
|
||
COPY entrypoint.sh / | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash | ||
|
||
KAFKA_VERSION="${KAFKA_VERSION:-3.1.0}" | ||
KAFKA_HOME="/opt/kafka-${KAFKA_VERSION}" | ||
|
||
if [ ! -d "${KAFKA_HOME}" ]; then | ||
echo 'Error: KAFKA_VERSION '$KAFKA_VERSION' not available in this image at '$KAFKA_HOME | ||
exit 1 | ||
fi | ||
|
||
cd "${KAFKA_HOME}" || exit 1 | ||
|
||
# discard all empty/commented lines | ||
sed -e '/^#/d' -e '/^$/d' -i"" config/server.properties | ||
|
||
# emulate kafka_configure_from_environment_variables from bitnami/bitnami-docker-kafka | ||
for var in "${!KAFKA_CFG_@}"; do | ||
key="$(echo "$var" | sed -e 's/^KAFKA_CFG_//g' -e 's/_/\./g' -e 's/.*/\L&/')" | ||
sed -e '/^'$key'/d' -i"" config/server.properties | ||
value="${!var}" | ||
echo "$key=$value" >>config/server.properties | ||
done | ||
|
||
sort config/server.properties | ||
|
||
exec bin/kafka-server-start.sh config/server.properties |