Skip to content

Commit 112e9a0

Browse files
update kafka strimzi support in Dockerfile
1 parent d0f4fc7 commit 112e9a0

1 file changed

Lines changed: 14 additions & 16 deletions

File tree

Dockerfile

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ FROM quay.io/strimzi/kafka:0.47.0-kafka-3.9.1 AS strimzi-source-extractor
4545

4646
USER root
4747

48-
ARG STRIMZI_VERSION=0.47.0
49-
5048
# Create directories to copy content out
5149
RUN mkdir -p /tmp/strimzi-extracted/scripts \
5250
/tmp/strimzi-extracted/kafka-exporter \
@@ -56,16 +54,12 @@ RUN mkdir -p /tmp/strimzi-extracted/scripts \
5654
/tmp/strimzi-extracted/usr-bin
5755

5856
#####
59-
# Add Kafka
60-
# Strimzi Step 1: Copy Strimzi Kafka scripts (e.g., kafka_run.sh) directly from source
61-
# Download and extract the Strimzi Kafka Operator tar file
57+
# Add Kafka Scripts
58+
# Strimzi Step 1: Copy Strimzi Kafka scripts (e.g., kafka_run.sh) from base image
59+
# Exclude non-strimzi scripts (i.e we only need ones defined here https://github.com/strimzi/strimzi-kafka-operator/tree/0.47.0/docker-images/kafka-based/kafka/scripts)
6260
#####
63-
RUN curl -L https://github.com/strimzi/strimzi-kafka-operator/archive/$STRIMZI_VERSION.tar.gz -o strimzi-kafka-operator.tar.gz && \
64-
tar -xzf strimzi-kafka-operator.tar.gz && \
65-
mv strimzi-kafka-operator-$STRIMZI_VERSION strimzi-kafka-operator
66-
67-
# Copy the required directories to the current working directory
68-
RUN cp -r strimzi-kafka-operator/docker-images/kafka-based/kafka/scripts /tmp/strimzi-extracted/scripts
61+
RUN cp -r /opt/kafka/* /tmp/strimzi-extracted/scripts
62+
RUN rm -rf /tmp/strimzi-extracted/scripts/LICENSE /tmp/strimzi-extracted/scripts/NOTICE /tmp/strimzi-extracted/scripts/bin /tmp/strimzi-extracted/scripts/config /tmp/strimzi-extracted/scripts/libs /tmp/strimzi-extracted/scripts/licenses /tmp/strimzi-extracted/scripts/plugins /tmp/strimzi-extracted/scripts/site-docs
6963

7064
#####
7165
# Exclude Kafka Exporter
@@ -92,9 +86,6 @@ RUN cp -r /opt/kafka/libs/* /tmp/strimzi-extracted/kafka-libs
9286
#####
9387
RUN cp -r /opt/cruise-control/* /tmp/strimzi-extracted/cruise-control
9488

95-
# Clean up downloaded files to reduce image size
96-
RUN rm -rf strimzi-kafka-operator.tar.gz strimzi-kafka-operator
97-
9889
# Verify the files were copied
9990
RUN ls -la /tmp/strimzi-extracted/scripts /tmp/strimzi-extracted/kafka-exporter /tmp/strimzi-extracted/prometheus-jmx-exporter /tmp/strimzi-extracted/kafka-libs /tmp/strimzi-extracted/cruise-control
10091

@@ -135,7 +126,7 @@ RUN set -eux ; \
135126
apk cache clean;
136127

137128
#####
138-
# Adapted Entrypoint in order to support
129+
# Needed to support an adapted entrypoint in support of
139130
# backwared-compatible BLC installations that may have been referencing
140131
# a Confluent-based Kafka Image, with added support for initialization
141132
# via the Strimzi Operator for K8 installations (https://strimzi.io/)
@@ -176,7 +167,7 @@ RUN mkdir -p ${KAFKA_HOME}/strimzi-scripts \
176167
# Copy Strimzi Kafka scripts
177168
COPY --from=strimzi-source-extractor --chown=appuser:root /tmp/strimzi-extracted/scripts ${KAFKA_HOME}/strimzi-scripts
178169
RUN chmod -R +x ${KAFKA_HOME}/strimzi-scripts
179-
RUN mv ${KAFKA_HOME}/strimzi-scripts/scripts/* ${KAFKA_HOME}
170+
RUN mv ${KAFKA_HOME}/strimzi-scripts/* ${KAFKA_HOME}
180171
RUN rm -rf ${KAFKA_HOME}/strimzi-scripts
181172

182173
# Do Nothing with Kafka Exporter Directory
@@ -204,4 +195,11 @@ WORKDIR $KAFKA_HOME
204195

205196
USER appuser
206197

198+
#####
199+
# Adapted Entrypoint in order to support
200+
# backwared-compatible BLC installations that may have been referencing
201+
# a Confluent-based Kafka Image. Note that this entrypoint is not used
202+
# when running this image via the Strimzi Operator as Strimzi
203+
# provides its own entrypoint. See https://github.com/strimzi/strimzi-kafka-operator
204+
#####
207205
CMD ["/etc/confluent/docker/run"]

0 commit comments

Comments
 (0)