Dockerfile.tx 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. FROM openjdk:8-jre-slim as builder1
  2. RUN sed -i "s@http://\(deb\|security\).debian.org@https://mirrors.aliyun.com@g" /etc/apt/sources.list
  3. # COPY docker/sources.list /etc/apt
  4. RUN apt update && apt install -y --no-install-recommends \
  5. krb5-user zip unzip procps tar curl supervisor net-tools telnet vim iputils-ping netcat jq wget
  6. # 目录准备
  7. WORKDIR /opt/cluster
  8. RUN mkdir -p hadoop spark livy/logs
  9. # spark
  10. COPY spark-3.0.3-bin-hadoop3.2.tgz spark
  11. RUN cd spark && tar zxfv spark-3.0.3-bin-hadoop3.2.tgz && mv spark*/* . && rm -rf spark-3.0.3-bin-hadoop3.2.tgz
  12. # hadoop
  13. COPY hadoop-3.2.3.tar.gz hadoop/hadoop.tgz
  14. RUN cd hadoop && tar zxfv hadoop.tgz && mv hadoop*/* . && rm -rf hadoop.tgz
  15. # livy
  16. COPY apache-livy-0.8.0-incubating-SNAPSHOT-bin.zip livy
  17. RUN cd livy && unzip apache-livy*.zip && mv apache-livy*bin/* .
  18. # jar包冲突
  19. RUN cp hadoop/share/hadoop/common/lib/jersey-core-1.19.jar livy/jars/
  20. RUN cp hadoop/share/hadoop/common/lib/jersey-core-1.19.jar spark/jars/
  21. RUN cp hadoop/share/hadoop/yarn/lib/jersey-client-1.19.jar spark/jars/
  22. RUN rm spark/jars/jersey-client-2.30.jar
  23. # 环境变量
  24. ENV HADOOP_HOME=/opt/cluster/hadoop
  25. ENV HADOOP_CONF_DIR=/opt/cluster/conf
  26. ENV HIVE_HOME=/opt/cluster/hive
  27. ENV HIVE_CONF_DIR=/opt/cluster/conf
  28. ENV SPARK_HOME=/opt/cluster/spark
  29. ENV SPARK_CONF_DIR=/opt/cluster/conf
  30. ENV LIVY_HOME=/opt/cluster/livy
  31. ENV LIVY_CONF_DIR=/opt/cluster/conf
  32. # 启动命令
  33. RUN echo "\
  34. [program:livy]\n\
  35. directory=/opt/cluster\n\
  36. command=livy/bin/livy-server \n\
  37. autorestart=true\n\
  38. startretries=0\n\
  39. redirect_stderr=true\n\
  40. stdout_logfile=/var/log/livy.log\n\
  41. stdout_logfile_maxbytes=50MB\n\
  42. " > /etc/supervisor/conf.d/livy.conf
  43. CMD ["supervisord", "-n"]
  44. FROM builder1 as image-txtest
  45. COPY docker/txtest .
  46. ADD docker/txtest/conf/krb5.conf /etc
  47. FROM builder1 as image-txprod
  48. COPY docker/txprod .
  49. ADD docker/txprod/conf/krb5.conf /etc