forked from ches/docker-kafka
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
49 lines (36 loc) · 1.34 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Builds an image for Apache Kafka from binary distribution.
#
FROM openjdk:8-jre-alpine
ARG KAFKA_VERSION=0.10.1.1
ARG KAFKA_SCALA_VERSION=2.11
LABEL name="kafka" \
version=$KAFKA_VERSION
maintainer "Jack Pickett <[email protected]>"
ENV KAFKA_VERSION=$KAFKA_VERSION KAFKA_SCALA_VERSION=$KAFKA_SCALA_VERSION JMX_PORT=7203
ENV KAFKA_RELEASE kafka_${KAFKA_SCALA_VERSION}-${KAFKA_VERSION}
RUN apk add --no-cache bash && \
mkdir /data /logs
# Download Kafka binary distribution
ADD http://www.us.apache.org/dist/kafka/${KAFKA_VERSION}/${KAFKA_RELEASE}.tgz /tmp/
ADD https://dist.apache.org/repos/dist/release/kafka/${KAFKA_VERSION}/${KAFKA_RELEASE}.tgz.sha1 /tmp/
WORKDIR /tmp
# Check artifact digest integrity
# Converts from gpg digest output format to sha1sum input
RUN awk -F':' '{gsub(" ","",$0);print tolower($2) " " $1}' ${KAFKA_RELEASE}.tgz.sha1 | sha1sum -c -
# Install Kafka to /kafka
RUN tar -zxf ${KAFKA_RELEASE}.tgz && \
mv ${KAFKA_RELEASE}/ /kafka && \
rm -rf kafka_*
ADD config /kafka/config
ADD start.sh /start.sh
# Set up a user to run Kafka
RUN addgroup kafka && \
adduser -D -h /kafka -G kafka -s /bin/false kafka && \
chown -R kafka:kafka /kafka /data /logs
USER kafka
ENV PATH /kafka/bin:$PATH
WORKDIR /kafka
# broker, jmx
EXPOSE 9092 ${JMX_PORT}
VOLUME [ "/data", "/logs" ]
CMD ["/start.sh"]