Newer
Older
docker-analytics / kafka / Dockerfile
  1. FROM nstanger/spark
  2.  
  3. ENV KAFKA_VERSION="2.2.2" \
  4. SCALA_VERSION="2.11" \
  5. APACHE_MIRROR="https://archive.apache.org/dist" \
  6. KAFKA_INSTALL="/usr/local"
  7.  
  8. RUN apt-get update && \
  9. apt-get install -y --no-install-recommends wget ; \
  10. # download, install, and symlink kafka
  11. cd $SPARK_INSTALL && \
  12. wget -q --show-progress --progress=bar:force:noscroll $APACHE_MIRROR/kafka/$KAFKA_VERSION/kafka_$SCALA_VERSION-$KAFKA_VERSION.tgz 2>&1 && \
  13. tar xzf kafka_$SCALA_VERSION-$KAFKA_VERSION.tgz && \
  14. ln -s kafka_$SCALA_VERSION-$KAFKA_VERSION kafka && \
  15. rm -f kafka_$SCALA_VERSION-$KAFKA_VERSION.tgz ; \
  16. # Clean up the crap
  17. apt-get remove -y --purge wget && \
  18. apt -y autoremove && \
  19. apt-get clean -y && \
  20. rm -rf /var/lib/apt/lists/* && \
  21. rm -rf /tmp/* && \
  22. rm -rf /var/cache/* && \
  23. rm -rf /root/.cache
  24.  
  25. # COPY start-master.sh /usr/local/bin/start-master.sh
  26. # COPY start-worker.sh /usr/local/bin/start-worker.sh
  27.  
  28. ENV KAFKA_HOME="$KAFKA_INSTALL/kafka"
  29. # SPARK_HOSTNAME="127.0.0.1" \
  30. # SPARK_MASTER_PORT="7077" \
  31. # SPARK_MASTER_WEBUI_PORT="8080" \
  32. # PYSPARK_PYTHON="/usr/local/bin/python3"
  33. COPY start-kafka.sh /usr/local/bin/
  34. COPY server.properties $KAFKA_HOME/config/
  35.  
  36. # Spark doesn't seem to respond directly to SIGTERM as the exit status is
  37. # for SIGKILL (137), after a pause. Presumably docker-compose down times out.
  38. # Using tini gives immediate exit with status 143 (SIGTERM).
  39. ENTRYPOINT ["/sbin/tini", "--"]
  40.  
  41. CMD ["/usr/local/bin/start-kafka.sh"]