59 lines
3.5 KiB
Docker
59 lines
3.5 KiB
Docker
|
# RX3-Docker/Kafka Dockerfile
|
||
|
#-------------------------------------------------------------------------------
|
||
|
|
||
|
ARG IMG_FROM_URL="rx3-docker/java:latest"
|
||
|
|
||
|
FROM ${IMG_FROM_URL}
|
||
|
|
||
|
ARG IMG_NAME
|
||
|
ARG IMG_NAME_FULL
|
||
|
ARG IMG_VERSION
|
||
|
ARG IMG_MAINTAINER
|
||
|
|
||
|
LABEL org.rx3.${IMG_NAME}.name=${IMG_NAME_FULL}
|
||
|
LABEL org.rx3.${IMG_NAME}.version=${IMG_VERSION}
|
||
|
LABEL org.rx3.${IMG_NAME}.maintainer=${IMG_MAINTAINER}
|
||
|
LABEL maintainer=${IMG_MAINTAINER}
|
||
|
|
||
|
ARG KAFKA_PORT
|
||
|
|
||
|
ARG KAFKA_HOME="/opt/appl/kafka"
|
||
|
|
||
|
|
||
|
|
||
|
#---------------------------------------------------------------------------------------------------
|
||
|
ARG KAFKAD='#!/bin/bash \n\
|
||
|
\n\
|
||
|
usermod -u ${KAFKA_UID} kafka \n\
|
||
|
groupmod -g ${KAFKA_GID} kafka \n\
|
||
|
\n\
|
||
|
chown -R kafka:kafka '${KAFKA_LIB}' '${KAFKA_LOG}' \n\
|
||
|
\n\
|
||
|
cd '${KAFKA_HOME}' \n\
|
||
|
\n\
|
||
|
KAFKA_CLUSTER_ID="$(bin/kafka-storage.sh random-uuid)" \n\
|
||
|
bin/kafka-storage.sh format --standalone -t \$KAFKA_CLUSTER_ID -c config/kraft/reconfig-server.properties'
|
||
|
#---------------------------------------------------------------------------------------------------
|
||
|
|
||
|
#---------------------------------------------------------------------------------------------------
|
||
|
ARG KAFKAD_INI='[program:kafkad] \n\
|
||
|
directory='${KAFKA_HOME}' \n\
|
||
|
command='${KAFKA_HOME}'/bin/kafka-server-start.sh config/kraft/reconfig-server.properties'
|
||
|
#---------------------------------------------------------------------------------------------------
|
||
|
|
||
|
|
||
|
|
||
|
RUN urpmi --force wget \
|
||
|
&& wget -q -O /tmp/kafka.tgz https://downloads.apache.org/kafka/3.9.0/kafka_2.13-3.9.0.tgz \
|
||
|
&& mkdir -p /opt/appl \
|
||
|
&& cd /opt/appl \
|
||
|
&& tar xf /tmp/kafka.tgz \
|
||
|
&& mv kafka* kafka \
|
||
|
&& rm /tmp/kafka.tgz \
|
||
|
&& echo -e "${KAFKAD}" | sed -e "s/\`/'/g" -e 's/ *$//' > /etc/init.d/kafkad \
|
||
|
&& chmod a+x /etc/init.d/kafkad \
|
||
|
&& ln -s /etc/init.d/kafkad /etc/rcD.d/S30kafkad \
|
||
|
&& echo -e "${KAFKAD_INI}" | sed -e "s/\`/'/g" -e 's/ *$//' > /etc/supervisord.d/kafkad.ini
|
||
|
|
||
|
EXPOSE ${KAFKA_PORT}
|