Dockerfile.sxkj 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. FROM ubuntu:18.04 AS builder
  2. RUN sed -i 's#archive.ubuntu.com#mirrors.aliyun.com#g' /etc/apt/sources.list \
  3. && sed -i 's#security.ubuntu.com#mirrors.aliyun.com#g' /etc/apt/sources.list
  4. ENV LANG=zh_CN.UTF-8 LANGUAGE=zh_CN:zh LC_ALL=zh_CN.UTF-8 DEBIAN_FRONTEND=noninteractive
  5. RUN rm -rf /etc/apt/sources.list.d/ && apt update
  6. # ARG USERNAME=sxkj
  7. # ARG USER_UID=1000
  8. # ARG USER_GID=$USER_UID
  9. # # Create the user
  10. # RUN groupadd --gid $USER_GID $USERNAME \
  11. # && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
  12. # #
  13. # # [Optional] Add sudo support. Omit if you don't need to install software after connecting.
  14. # && apt-get update \
  15. # && apt-get install -y sudo \
  16. # && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
  17. # && chmod 0440 /etc/sudoers.d/$USERNAME
  18. RUN apt-get update && apt-get install -y --no-install-recommends \
  19. supervisor \
  20. iputils-ping \
  21. wget \
  22. zsh \
  23. build-essential \
  24. cmake \
  25. git \
  26. curl \
  27. vim \
  28. ca-certificates \
  29. zip \
  30. unzip \
  31. openjdk-8-jdk \
  32. && rm -rf /var/lib/apt/lists/*
  33. CMD ["supervisord", "-n"]
  34. FROM builder as builder1
  35. # ********************************************************
  36. # * Anything else you want to do like clean up goes here *
  37. # ********************************************************
  38. # [Optional] Set the default user. Omit if you want to keep the default as root.
  39. # USER $USERNAME
  40. # ENV HOME /home/sxkj
  41. # ENV WORKSPACE ${HOME}/bigdata
  42. # WORKDIR ${WORKSPACE}
  43. # RUN sudo chown -R sxkj:sxkj ${WORKSPACE}
  44. # 目录准备
  45. ENV WORKSPACE /workspace
  46. WORKDIR ${WORKSPACE}
  47. RUN mkdir -p hadoop livy spark
  48. # hadoop
  49. COPY hadoop-2.7.5.tar.gz hadoop
  50. RUN cd hadoop && tar xzvf hadoop-2.7.5.tar.gz && mv hadoop-2.7.5*/* . && rm -rf hadoop-2.7.5*
  51. # spark
  52. COPY spark-2.4.7-bin-hadoop2.7.tgz spark
  53. RUN cd spark && tar xzvf spark-2.4.7-bin-hadoop2.7.tgz && mv spark-2.4.7*/* . && rm -rf spark-2.4.7*
  54. # livy
  55. # COPY apache-livy-0.7.1-incubating-bin.zip livy
  56. # COPY apache-livy-0.8.0-spark-2.4.7-hadoop-2.7-bin.zip livy
  57. COPY apache-livy-0.8.1-incubating-SNAPSHOT-bin.zip livy
  58. RUN cd livy && unzip apache-livy-*.zip && mv apache*/* . && rm -rf apache-livy-*
  59. # ENVS
  60. # java
  61. ENV JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
  62. ENV PATH=$JAVA_HOME/bin:$PATH
  63. # hadoop
  64. ENV JAVA_LIBRARY_PATH=$HADOOP_HOME/lib/native
  65. ENV HADOOP_HOME=${WORKSPACE}/hadoop
  66. ENV HADOOP_CONF_DIR=${WORKSPACE}/conf
  67. ENV PATH=$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$PATH
  68. # spark
  69. ENV SPARK_HOME=${WORKSPACE}/spark
  70. ENV PATH=$SPARK_HOME/bin:$PATH
  71. ENV SPARK_CONF_DIR=${WORKSPACE}/conf
  72. ENV LIVY_HOME=${WORKSPACE}/livy
  73. ENV PATH=$LIVY_HOME/bin:$PATH
  74. ENV LIVY_CONF_DIR=${WORKSPACE}/conf
  75. # 启动命令
  76. RUN echo "\
  77. [program:livy]\n\
  78. directory=/workspace\n\
  79. command=livy/bin/livy-server \n\
  80. autorestart=true\n\
  81. startretries=0\n\
  82. redirect_stderr=true\n\
  83. stdout_logfile=/var/log/livy.log\n\
  84. stdout_logfile_maxbytes=50MB\n\
  85. " > /etc/supervisor/conf.d/livy.conf
  86. RUN mkdir -p ${WORKSPACE}/livy/logs
  87. FROM builder1 as image-sxkj
  88. COPY docker/sxkj .