-
Notifications
You must be signed in to change notification settings - Fork 137
/
Dockerfile
53 lines (40 loc) · 1.62 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
49
50
51
52
# Builds an image for Apache Kafka from binary distribution.
#
# The netflixoss/java base image runs Oracle Java 8 installed atop the
# ubuntu:trusty (14.04) official image. Docker's official java images are
# OpenJDK-only currently, and the Kafka project, Confluent, and most other
# major Java projects test and recommend Oracle Java for production for optimal
# performance.
FROM netflixoss/java:8
MAINTAINER Ches Martin <ches@whiskeyandgrits.net>
# The Scala 2.12 build is currently recommended by the project.
ENV KAFKA_VERSION=0.10.2.1 KAFKA_SCALA_VERSION=2.12 JMX_PORT=7203
ENV KAFKA_RELEASE_ARCHIVE kafka_${KAFKA_SCALA_VERSION}-${KAFKA_VERSION}.tgz
RUN mkdir /kafka /data /logs
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
ca-certificates
# Download Kafka binary distribution
ADD http://www.us.apache.org/dist/kafka/${KAFKA_VERSION}/${KAFKA_RELEASE_ARCHIVE} /tmp/
ADD https://dist.apache.org/repos/dist/release/kafka/${KAFKA_VERSION}/${KAFKA_RELEASE_ARCHIVE}.md5 /tmp/
WORKDIR /tmp
# Check artifact digest integrity
RUN echo VERIFY CHECKSUM: && \
gpg --print-md MD5 ${KAFKA_RELEASE_ARCHIVE} 2>/dev/null && \
cat ${KAFKA_RELEASE_ARCHIVE}.md5
# Install Kafka to /kafka
RUN tar -zx -C /kafka --strip-components=1 -f ${KAFKA_RELEASE_ARCHIVE} && \
rm -rf kafka_*
ADD config /kafka/config
ADD start.sh /start.sh
# Set up a user to run Kafka
RUN groupadd kafka && \
useradd -d /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"]