Skip to content

Commit 9efdf10

Browse files
jimbogithubsfat
andauthored
Switch from Alpine to Debian to get newer multi-arch JRE (#703)
* Switch from Alpine to Debian to get newer multi-arch JRE. * Log raw topic info during CI build. * Revised 'compact/snappy' config check. Deal with output spacing variability. * Drop support for kafka 2.0.1 * Update CHANGELOG. Co-authored-by: Andrei Sfat <andrei@sfat.me>
1 parent a49ac63 commit 9efdf10

File tree

5 files changed

+44
-24
lines changed

5 files changed

+44
-24
lines changed

.travis.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ env:
1313
# Build recommended versions based on: http://kafka.apache.org/downloads
1414
matrix:
1515
include:
16-
- scala: 2.12
17-
env: KAFKA_VERSION=2.0.1
1816
- scala: 2.12
1917
env: KAFKA_VERSION=2.1.1
2018
- scala: 2.12

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ Changelog
33

44
Kafka features are not tied to a specific kafka-docker version (ideally all changes will be merged into all branches). Therefore, this changelog will track changes to the image by date.
55

6+
09-Apr-2022
7+
----------
8+
9+
- Switched to openjdk:11-jre-slim for multi-arch support.
10+
- Drop support for Kafka `2.0.1` due to JDK upgrade.
11+
612
04-Oct-2021
713
----------
814

Dockerfile

Lines changed: 33 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
FROM azul/zulu-openjdk-alpine:8u292-8.54.0.21
1+
FROM openjdk:11-jre-slim
22

33
ARG kafka_version=2.8.1
44
ARG scala_version=2.13
5-
ARG glibc_version=2.31-r0
65
ARG vcs_ref=unspecified
76
ARG build_date=unspecified
87

@@ -17,24 +16,41 @@ LABEL org.label-schema.name="kafka" \
1716

1817
ENV KAFKA_VERSION=$kafka_version \
1918
SCALA_VERSION=$scala_version \
20-
KAFKA_HOME=/opt/kafka \
21-
GLIBC_VERSION=$glibc_version
19+
KAFKA_HOME=/opt/kafka
2220

2321
ENV PATH=${PATH}:${KAFKA_HOME}/bin
2422

25-
COPY download-kafka.sh start-kafka.sh broker-list.sh create-topics.sh versions.sh /tmp/
26-
27-
RUN apk add --no-cache bash curl jq docker \
28-
&& chmod a+x /tmp/*.sh \
29-
&& mv /tmp/start-kafka.sh /tmp/broker-list.sh /tmp/create-topics.sh /tmp/versions.sh /usr/bin \
30-
&& sync && /tmp/download-kafka.sh \
31-
&& tar xfz /tmp/kafka_${SCALA_VERSION}-${KAFKA_VERSION}.tgz -C /opt \
32-
&& rm /tmp/kafka_${SCALA_VERSION}-${KAFKA_VERSION}.tgz \
33-
&& ln -s /opt/kafka_${SCALA_VERSION}-${KAFKA_VERSION} ${KAFKA_HOME} \
34-
&& rm /tmp/* \
35-
&& wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-${GLIBC_VERSION}.apk \
36-
&& apk add --no-cache --allow-untrusted glibc-${GLIBC_VERSION}.apk \
37-
&& rm glibc-${GLIBC_VERSION}.apk
23+
COPY download-kafka.sh start-kafka.sh broker-list.sh create-topics.sh versions.sh /tmp2/
24+
25+
RUN set -eux ; \
26+
apt-get update ; \
27+
apt-get upgrade -s ; \
28+
apt-get install -y --no-install-recommends jq net-tools curl wget ; \
29+
### BEGIN docker for CI tests
30+
apt-get install -y --no-install-recommends gnupg lsb-release ; \
31+
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg ; \
32+
echo \
33+
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \
34+
$(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null ; \
35+
apt-get update ; \
36+
apt-get install -y --no-install-recommends docker-ce-cli ; \
37+
apt remove -y gnupg lsb-release ; \
38+
apt clean ; \
39+
apt autoremove -y ; \
40+
apt -f install ; \
41+
### END docker for CI tests
42+
### BEGIN other for CI tests
43+
apt-get install -y --no-install-recommends netcat ; \
44+
### END other for CI tests
45+
chmod a+x /tmp2/*.sh ; \
46+
mv /tmp2/start-kafka.sh /tmp2/broker-list.sh /tmp2/create-topics.sh /tmp2/versions.sh /usr/bin ; \
47+
sync ; \
48+
/tmp2/download-kafka.sh ; \
49+
tar xfz /tmp2/kafka_${SCALA_VERSION}-${KAFKA_VERSION}.tgz -C /opt ; \
50+
rm /tmp2/kafka_${SCALA_VERSION}-${KAFKA_VERSION}.tgz ; \
51+
ln -s /opt/kafka_${SCALA_VERSION}-${KAFKA_VERSION} ${KAFKA_HOME} ; \
52+
rm -rf /tmp2 ; \
53+
rm -rf /var/lib/apt/lists/*
3854

3955
COPY overrides /opt/overrides
4056

download-kafka.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
#!/bin/sh -e
22

33
# shellcheck disable=SC1091
4-
source "/usr/bin/versions.sh"
4+
. "/usr/bin/versions.sh"
55

66
FILENAME="kafka_${SCALA_VERSION}-${KAFKA_VERSION}.tgz"
77

88
url=$(curl --stderr /dev/null "https://www.apache.org/dyn/closer.cgi?path=/kafka/${KAFKA_VERSION}/${FILENAME}&as_json=1" | jq -r '"\(.preferred)\(.path_info)"')
99

1010
# Test to see if the suggested mirror has this version, currently pre 2.1.1 versions
1111
# do not appear to be actively mirrored. This may also be useful if closer.cgi is down.
12-
if [[ ! $(curl -f -s -r 0-1 "${url}") ]]; then
12+
if [ ! "$(curl -f -s -r 0-1 "${url}")" ]; then
1313
echo "Mirror does not have desired version, downloading direct from Apache"
1414
url="https://archive.apache.org/dist/kafka/${KAFKA_VERSION}/${FILENAME}"
1515
fi
1616

1717
echo "Downloading Kafka from $url"
18-
wget "${url}" -O "/tmp/${FILENAME}"
18+
wget "${url}" -O "/tmp2/${FILENAME}"

test/0.10/test.create-topics.kafka.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ testCreateTopics() {
1111
CLEANUP[0]=""
1212

1313
TOPICS[1]="compact-$NOW"
14-
CLEANUP[1]="compact,compression.type=snappy"
14+
CLEANUP[1]="compression.type=snappy,cleanup.policy=compact"
1515

1616
KAFKA_CREATE_TOPICS="${TOPICS[0]}:1:1,${TOPICS[1]}:2:1:compact --config=compression.type=snappy" create-topics.sh
1717

@@ -22,7 +22,7 @@ testCreateTopics() {
2222
echo "Validating topic '$TOPIC'"
2323

2424
EXISTS=$(/opt/kafka/bin/kafka-topics.sh --zookeeper "$KAFKA_ZOOKEEPER_CONNECT" --list --topic "$TOPIC")
25-
POLICY=$(/opt/kafka/bin/kafka-configs.sh --zookeeper "$KAFKA_ZOOKEEPER_CONNECT" --entity-type topics --entity-name "$TOPIC" --describe | grep 'Configs for topic' | awk -F'cleanup.policy=' '{print $2}')
25+
POLICY=$(/opt/kafka/bin/kafka-topics.sh --zookeeper "$KAFKA_ZOOKEEPER_CONNECT" --describe --topic "$TOPIC" | awk -F'Configs:' '{print $2}' | xargs)
2626

2727
RESULT="$EXISTS:$POLICY"
2828
EXPECTED="$TOPIC:${CLEANUP[i]}"

0 commit comments

Comments
 (0)