Dockerfile 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. FROM maven:3.8.6-openjdk-8 as builder
  2. WORKDIR /workspace
  3. RUN sed -i "s@http://\(deb\|security\).debian.org@https://mirrors.aliyun.com@g" /etc/apt/sources.list
  4. RUN apt update && apt install -y python3 python3-pip python-is-python3 \
  5. && pip config set global.index-url https://mirror.nju.edu.cn/pypi/web/simple
  6. ADD . .
  7. RUN mkdir -p ~/.m2 && cp -r docker/settings.xml ~/.m2
  8. RUN wget http://mirror.nju.edu.cn/apache/spark/spark-3.1.3/spark-3.1.3-bin-hadoop3.2.tgz
  9. RUN mvn clean package \
  10. -B -V -e \
  11. -Pspark-3.0 \
  12. -Pthriftserver \
  13. -DskipTests \
  14. -DskipITs \
  15. -Dmaven.javadoc.skip=true
  16. FROM openjdk:8-jre-slim
  17. RUN sed -i "s@http://\(deb\|security\).debian.org@https://mirrors.aliyun.com@g" /etc/apt/sources.list
  18. # COPY docker/sources.list /etc/apt
  19. RUN apt update && apt install -y krb5-user zip unzip procps tar curl
  20. WORKDIR /opt/cluster
  21. COPY docker/cluster .
  22. ENV HADOOP_HOME=/opt/cluster/hadoop
  23. ENV HADOOP_CONF_DIR=/opt/cluster/conf
  24. ENV HIVE_HOME=/opt/cluster/hive
  25. ENV HIVE_CONF_DIR=/opt/cluster/conf
  26. ENV SPARK_HOME=/opt/cluster/spark
  27. ENV SPARK_CONF_DIR=/opt/cluster/conf
  28. ENV LIVY_HOME=/opt/cluster/livy
  29. ENV LIVY_CONF_DIR=/opt/cluster/conf
  30. RUN rm -rf /opt/cluster/livy/*
  31. # COPY docker/livy /opt/cluster/livy/
  32. RUN mkdir -p hadoop spark livy/logs
  33. RUN curl -o ./hadoop/hadoop.tgz -O http://mirror.nju.edu.cn/apache/hadoop/common/hadoop-3.2.3/hadoop-3.2.3.tar.gz && \
  34. curl -o ./spark/spark.tgz -O http://mirror.nju.edu.cn/apache/spark/spark-3.1.3/spark-3.1.3-bin-hadoop3.2.tgz
  35. RUN cd hadoop && tar zxfv hadoop.tgz && mv hadoop*/* . && rm -rf hadoop.tgz
  36. RUN cd spark && tar zxfv spark.tgz && mv spark*/* . && rm -rf spark.tgz
  37. ADD docker/krb5.conf /etc
  38. COPY --from=builder /workspace/assembly/target/apache-livy*.zip livy
  39. # ADD assembly/target/apache-livy*.zip /opt/cluster/livy/
  40. RUN cd /opt/cluster/livy/ && unzip apache-livy*.zip && mv apache-livy*bin/* .
  41. RUN cp hadoop/share/hadoop/common/lib/jersey-core-1.19.jar livy/jars/
  42. RUN cp hadoop/share/hadoop/common/lib/jersey-core-1.19.jar spark/jars/
  43. RUN cp hadoop/share/hadoop/yarn/lib/jersey-client-1.19.jar spark/jars/
  44. RUN rm spark/jars/jersey-client-2.30.jar
  45. CMD ["livy/bin/livy-server"]