Dockerfile 6.7 KB

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