Dockerfile 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  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. clang \
  42. curl \
  43. doxygen \
  44. fuse \
  45. g++ \
  46. gcc \
  47. git \
  48. gnupg-agent \
  49. libbz2-dev \
  50. libcurl4-openssl-dev \
  51. libfuse-dev \
  52. libprotobuf-dev \
  53. libprotoc-dev \
  54. libsasl2-dev \
  55. libsnappy-dev \
  56. libssl-dev \
  57. libtool \
  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. valgrind \
  73. zlib1g-dev \
  74. && apt-get clean \
  75. && rm -rf /var/lib/apt/lists/*
  76. #######
  77. # OpenJDK 8
  78. #######
  79. # hadolint ignore=DL3008
  80. RUN apt-get -q update \
  81. && apt-get -q install -y --no-install-recommends openjdk-8-jdk libbcprov-java \
  82. && apt-get clean \
  83. && rm -rf /var/lib/apt/lists/*
  84. ######
  85. # Install cmake 3.1.0 (3.5.1 ships with Xenial)
  86. ######
  87. RUN mkdir -p /opt/cmake \
  88. && curl -L -s -S \
  89. https://cmake.org/files/v3.1/cmake-3.1.0-Linux-x86_64.tar.gz \
  90. -o /opt/cmake.tar.gz \
  91. && tar xzf /opt/cmake.tar.gz --strip-components 1 -C /opt/cmake
  92. ENV CMAKE_HOME /opt/cmake
  93. ENV PATH "${PATH}:/opt/cmake/bin"
  94. ######
  95. # Install Google Protobuf 2.5.0 (2.6.0 ships with Xenial)
  96. ######
  97. # hadolint ignore=DL3003
  98. RUN mkdir -p /opt/protobuf-src \
  99. && curl -L -s -S \
  100. https://github.com/google/protobuf/releases/download/v2.5.0/protobuf-2.5.0.tar.gz \
  101. -o /opt/protobuf.tar.gz \
  102. && tar xzf /opt/protobuf.tar.gz --strip-components 1 -C /opt/protobuf-src \
  103. && cd /opt/protobuf-src \
  104. && ./configure --prefix=/opt/protobuf \
  105. && make install \
  106. && cd /root \
  107. && rm -rf /opt/protobuf-src
  108. ENV PROTOBUF_HOME /opt/protobuf
  109. ENV PATH "${PATH}:/opt/protobuf/bin"
  110. ######
  111. # Install Apache Maven 3.3.9 (3.3.9 ships with Xenial)
  112. ######
  113. # hadolint ignore=DL3008
  114. RUN apt-get -q update \
  115. && apt-get -q install -y --no-install-recommends maven \
  116. && apt-get clean \
  117. && rm -rf /var/lib/apt/lists/*
  118. ENV MAVEN_HOME /usr
  119. ######
  120. # Install findbugs 3.0.1 (3.0.1 ships with Xenial)
  121. # Ant is needed for findbugs
  122. ######
  123. # hadolint ignore=DL3008
  124. RUN apt-get -q update \
  125. && apt-get -q install -y --no-install-recommends findbugs ant \
  126. && apt-get clean \
  127. && rm -rf /var/lib/apt/lists/*
  128. ENV FINDBUGS_HOME /usr
  129. ####
  130. # Install shellcheck (0.4.6, the latest as of 2017-09-26)
  131. ####
  132. # hadolint ignore=DL3008
  133. RUN add-apt-repository -y ppa:jonathonf/ghc-8.0.2 \
  134. && apt-get -q update \
  135. && apt-get -q install -y --no-install-recommends shellcheck \
  136. && apt-get clean \
  137. && rm -rf /var/lib/apt/lists/*
  138. ####
  139. # Install bats (0.4.0, the latest as of 2017-09-26, ships with Xenial)
  140. ####
  141. # hadolint ignore=DL3008
  142. RUN apt-get -q update \
  143. && apt-get -q install -y --no-install-recommends bats \
  144. && apt-get clean \
  145. && rm -rf /var/lib/apt/lists/*
  146. ####
  147. # Install pylint at fixed version (2.0.0 removed python2 support)
  148. # https://github.com/PyCQA/pylint/issues/2294
  149. ####
  150. RUN pip2 install pylint==1.9.2
  151. ####
  152. # Install dateutil.parser
  153. ####
  154. RUN pip2 install python-dateutil==2.7.3
  155. ###
  156. # Install node.js for web UI framework (4.2.6 ships with Xenial)
  157. ###
  158. # hadolint ignore=DL3008, DL3016
  159. RUN apt-get -q update \
  160. && apt-get install -y --no-install-recommends nodejs npm \
  161. && apt-get clean \
  162. && rm -rf /var/lib/apt/lists/* \
  163. && ln -s /usr/bin/nodejs /usr/bin/node \
  164. && npm install npm@latest -g \
  165. && npm install -g jshint
  166. ###
  167. # Install hadolint
  168. ####
  169. RUN curl -L -s -S \
  170. https://github.com/hadolint/hadolint/releases/download/v1.11.1/hadolint-Linux-x86_64 \
  171. -o /bin/hadolint \
  172. && chmod a+rx /bin/hadolint \
  173. && shasum -a 512 /bin/hadolint | \
  174. awk '$1!="734e37c1f6619cbbd86b9b249e69c9af8ee1ea87a2b1ff71dccda412e9dac35e63425225a95d71572091a3f0a11e9a04c2fc25d9e91b840530c26af32b9891ca" {exit(1)}'
  175. ###
  176. # Avoid out of memory errors in builds
  177. ###
  178. ENV MAVEN_OPTS -Xms256m -Xmx1536m
  179. ###
  180. # Everything past this point is either not needed for testing or breaks Yetus.
  181. # So tell Yetus not to read the rest of the file:
  182. # YETUS CUT HERE
  183. ###
  184. ####
  185. # Install svn & Forrest (for Apache Hadoop website)
  186. ###
  187. # hadolint ignore=DL3008
  188. RUN apt-get -q update \
  189. && apt-get -q install -y --no-install-recommends subversion \
  190. && apt-get clean \
  191. && rm -rf /var/lib/apt/lists/*
  192. RUN mkdir -p /opt/apache-forrest \
  193. && curl -L -s -S \
  194. https://archive.apache.org/dist/forrest/0.8/apache-forrest-0.8.tar.gz \
  195. -o /opt/forrest.tar.gz \
  196. && tar xzf /opt/forrest.tar.gz --strip-components 1 -C /opt/apache-forrest
  197. RUN echo 'forrest.home=/opt/apache-forrest' > build.properties
  198. ENV FORREST_HOME=/opt/apache-forrest
  199. # Hugo static website generator (for new hadoop site and Ozone docs)
  200. RUN curl -L -o hugo.deb https://github.com/gohugoio/hugo/releases/download/v0.30.2/hugo_0.30.2_Linux-64bit.deb \
  201. && dpkg --install hugo.deb \
  202. && rm hugo.deb
  203. # Add a welcome message and environment checks.
  204. COPY hadoop_env_checks.sh /root/hadoop_env_checks.sh
  205. RUN chmod 755 /root/hadoop_env_checks.sh
  206. # hadolint ignore=SC2016
  207. RUN echo '${HOME}/hadoop_env_checks.sh' >> /root/.bashrc