Dockerfile 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. # Licensed to the Apache Software Foundation (ASF) under one
  2. # or more contributor license agreements. See the NOTICE file
  3. # distributed with this work for additional information
  4. # regarding copyright ownership. The ASF licenses this file
  5. # to you under the Apache License, Version 2.0 (the
  6. # "License"); you may not use this file except in compliance
  7. # with the License. You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. # Dockerfile for installing the necessary dependencies for building Hadoop.
  17. # See BUILDING.txt.
  18. FROM ubuntu:xenial
  19. WORKDIR /root
  20. SHELL ["/bin/bash", "-o", "pipefail", "-c"]
  21. #####
  22. # Disable suggests/recommends
  23. #####
  24. RUN echo APT::Install-Recommends "0"\; > /etc/apt/apt.conf.d/10disableextras
  25. RUN echo APT::Install-Suggests "0"\; >> /etc/apt/apt.conf.d/10disableextras
  26. ENV DEBIAN_FRONTEND noninteractive
  27. ENV DEBCONF_TERSE true
  28. ######
  29. # Install common dependencies from packages. Versions here are either
  30. # sufficient or irrelevant.
  31. #
  32. # WARNING: DO NOT PUT JAVA APPS HERE! Otherwise they will install default
  33. # Ubuntu Java. See Java section below!
  34. ######
  35. # hadolint ignore=DL3008
  36. RUN apt-get -q update \
  37. && apt-get -q install -y --no-install-recommends \
  38. apt-utils \
  39. build-essential \
  40. bzip2 \
  41. curl \
  42. doxygen \
  43. fuse \
  44. g++ \
  45. gcc \
  46. git \
  47. gnupg-agent \
  48. libbz2-dev \
  49. libcurl4-openssl-dev \
  50. libfuse-dev \
  51. libprotobuf-dev \
  52. libprotoc-dev \
  53. libsasl2-dev \
  54. libsnappy-dev \
  55. libssl-dev \
  56. libtool \
  57. libzstd1-dev \
  58. locales \
  59. make \
  60. pinentry-curses \
  61. pkg-config \
  62. python \
  63. python2.7 \
  64. python-pip \
  65. python-pkg-resources \
  66. python-setuptools \
  67. python-wheel \
  68. rsync \
  69. software-properties-common \
  70. snappy \
  71. sudo \
  72. zlib1g-dev \
  73. && apt-get clean \
  74. && rm -rf /var/lib/apt/lists/*
  75. #######
  76. # OpenJDK 8
  77. #######
  78. # hadolint ignore=DL3008
  79. RUN apt-get -q update \
  80. && apt-get -q install -y --no-install-recommends openjdk-8-jdk \
  81. && apt-get clean \
  82. && rm -rf /var/lib/apt/lists/*
  83. #######
  84. # OpenJDK 7
  85. #######
  86. # hadolint ignore=DL3008
  87. RUN add-apt-repository ppa:openjdk-r/ppa
  88. RUN apt-get -q update \
  89. && apt-get -q install -y --no-install-recommends openjdk-7-jdk \
  90. && apt-get clean \
  91. && rm -rf /var/lib/apt/lists/*
  92. RUN update-java-alternatives --set java-1.7.0-openjdk-amd64
  93. ######
  94. # Install cmake 3.1.0 (3.5.1 ships with Xenial)
  95. ######
  96. RUN mkdir -p /opt/cmake \
  97. && curl -L -s -S \
  98. https://cmake.org/files/v3.1/cmake-3.1.0-Linux-x86_64.tar.gz \
  99. -o /opt/cmake.tar.gz \
  100. && tar xzf /opt/cmake.tar.gz --strip-components 1 -C /opt/cmake
  101. ENV CMAKE_HOME /opt/cmake
  102. ENV PATH "${PATH}:/opt/cmake/bin"
  103. ######
  104. # Install Google Protobuf 2.5.0 (2.6.0 ships with Xenial)
  105. ######
  106. # hadolint ignore=DL3003
  107. RUN mkdir -p /opt/protobuf-src \
  108. && curl -L -s -S \
  109. https://github.com/google/protobuf/releases/download/v2.5.0/protobuf-2.5.0.tar.gz \
  110. -o /opt/protobuf.tar.gz \
  111. && tar xzf /opt/protobuf.tar.gz --strip-components 1 -C /opt/protobuf-src \
  112. && cd /opt/protobuf-src \
  113. && ./configure --prefix=/opt/protobuf \
  114. && make install \
  115. && cd /root \
  116. && rm -rf /opt/protobuf-src
  117. ENV PROTOBUF_HOME /opt/protobuf
  118. ENV PATH "${PATH}:/opt/protobuf/bin"
  119. ######
  120. # Install Apache Maven 3.3.9 (3.3.9 ships with Xenial)
  121. ######
  122. # hadolint ignore=DL3008
  123. RUN apt-get -q update \
  124. && apt-get -q install -y --no-install-recommends maven \
  125. && apt-get clean \
  126. && rm -rf /var/lib/apt/lists/*
  127. ENV MAVEN_HOME /usr
  128. ######
  129. # Install Apache Ant 1.9.6 (1.9.6 ships with Xenial)
  130. ######
  131. # hadolint ignore=DL3008
  132. RUN apt-get -q update \
  133. && apt-get -q install -y --no-install-recommends ant \
  134. && apt-get clean \
  135. && rm -rf /var/lib/apt/lists/*
  136. ######
  137. # Install findbugs 3.0.1 (3.0.1 ships with Xenial)
  138. ######
  139. # hadolint ignore=DL3008
  140. RUN apt-get -q update \
  141. && apt-get -q install -y --no-install-recommends findbugs \
  142. && apt-get clean \
  143. && rm -rf /var/lib/apt/lists/*
  144. ENV FINDBUGS_HOME /usr
  145. ####
  146. # Install shellcheck (0.4.6, the latest as of 2017-09-26)
  147. ####
  148. # hadolint ignore=DL3008
  149. RUN add-apt-repository -y ppa:jonathonf/ghc-8.0.2 \
  150. && apt-get -q update \
  151. && apt-get -q install -y --no-install-recommends shellcheck \
  152. && apt-get clean \
  153. && rm -rf /var/lib/apt/lists/*
  154. ####
  155. # Install bats (0.4.0, the latest as of 2017-09-26, ships with Xenial)
  156. ####
  157. # hadolint ignore=DL3008
  158. RUN apt-get -q update \
  159. && apt-get -q install -y --no-install-recommends bats \
  160. && apt-get clean \
  161. && rm -rf /var/lib/apt/lists/*
  162. ####
  163. # Install pylint at fixed version (2.0.0 removed python2 support)
  164. # https://github.com/PyCQA/pylint/issues/2294
  165. ####
  166. RUN pip2 install pylint==1.9.2
  167. ####
  168. # Install dateutil.parser
  169. ####
  170. RUN pip2 install python-dateutil==2.7.3
  171. ###
  172. # Install node.js for web UI framework (4.2.6 ships with Xenial)
  173. ###
  174. # hadolint ignore=DL3008, DL3016
  175. RUN apt-get -q update \
  176. && apt-get install -y --no-install-recommends nodejs npm \
  177. && apt-get clean \
  178. && rm -rf /var/lib/apt/lists/* \
  179. && ln -s /usr/bin/nodejs /usr/bin/node \
  180. && npm install npm@latest -g \
  181. && npm install -g jshint
  182. ###
  183. # Install hadolint
  184. ####
  185. RUN curl -L -s -S \
  186. https://github.com/hadolint/hadolint/releases/download/v1.11.1/hadolint-Linux-x86_64 \
  187. -o /bin/hadolint \
  188. && chmod a+rx /bin/hadolint \
  189. && shasum -a 512 /bin/hadolint | \
  190. awk '$1!="734e37c1f6619cbbd86b9b249e69c9af8ee1ea87a2b1ff71dccda412e9dac35e63425225a95d71572091a3f0a11e9a04c2fc25d9e91b840530c26af32b9891ca" {exit(1)}'
  191. ###
  192. # Avoid out of memory errors in builds
  193. ###
  194. ENV MAVEN_OPTS -Xms256m -Xmx1536m -Dhttps.protocols=TLSv1.2 -Dhttps.cipherSuites=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
  195. ###
  196. # Everything past this point is either not needed for testing or breaks Yetus.
  197. # So tell Yetus not to read the rest of the file:
  198. # YETUS CUT HERE
  199. ###
  200. ####
  201. # Install svn & Forrest (for Apache Hadoop website)
  202. ###
  203. # hadolint ignore=DL3008
  204. RUN apt-get -q update \
  205. && apt-get -q install -y --no-install-recommends subversion \
  206. && apt-get clean \
  207. && rm -rf /var/lib/apt/lists/*
  208. RUN mkdir -p /opt/apache-forrest \
  209. && curl -L -s -S \
  210. https://archive.apache.org/dist/forrest/0.8/apache-forrest-0.8.tar.gz \
  211. -o /opt/forrest.tar.gz \
  212. && tar xzf /opt/forrest.tar.gz --strip-components 1 -C /opt/apache-forrest
  213. RUN echo 'forrest.home=/opt/apache-forrest' > build.properties
  214. ENV FORREST_HOME=/opt/apache-forrest
  215. # Hugo static website generator (for new hadoop site and Ozone docs)
  216. RUN curl -L -o hugo.deb https://github.com/gohugoio/hugo/releases/download/v0.30.2/hugo_0.30.2_Linux-64bit.deb \
  217. && dpkg --install hugo.deb \
  218. && rm hugo.deb
  219. # Add a welcome message and environment checks.
  220. COPY hadoop_env_checks.sh /root/hadoop_env_checks.sh
  221. RUN chmod 755 /root/hadoop_env_checks.sh
  222. # hadolint ignore=SC2016
  223. RUN echo '${HOME}/hadoop_env_checks.sh' >> /root/.bashrc