Dockerfile 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  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:focal
  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. # hadolint ignore=DL3008
  29. RUN apt-get -q update \
  30. && apt-get -q install -y --no-install-recommends \
  31. ant \
  32. apt-utils \
  33. bats \
  34. build-essential \
  35. bzip2 \
  36. clang \
  37. cmake \
  38. curl \
  39. doxygen \
  40. fuse \
  41. g++ \
  42. gcc \
  43. git \
  44. gnupg-agent \
  45. hugo \
  46. libbcprov-java \
  47. libbz2-dev \
  48. libcurl4-openssl-dev \
  49. libfuse-dev \
  50. libprotobuf-dev \
  51. libprotoc-dev \
  52. libsasl2-dev \
  53. libsnappy-dev \
  54. libssl-dev \
  55. libtool \
  56. libzstd-dev \
  57. locales \
  58. make \
  59. maven \
  60. nodejs \
  61. node-yarn \
  62. npm \
  63. openjdk-11-jdk \
  64. openjdk-8-jdk \
  65. pinentry-curses \
  66. pkg-config \
  67. python3 \
  68. python3-pip \
  69. python3-pkg-resources \
  70. python3-setuptools \
  71. python3-wheel \
  72. rsync \
  73. shellcheck \
  74. software-properties-common \
  75. sudo \
  76. valgrind \
  77. zlib1g-dev \
  78. && apt-get clean \
  79. && rm -rf /var/lib/apt/lists/*
  80. RUN locale-gen en_US.UTF-8
  81. ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'
  82. ENV PYTHONIOENCODING=utf-8
  83. ######
  84. # Set env vars required to build Hadoop
  85. ######
  86. ENV MAVEN_HOME /usr
  87. # JAVA_HOME must be set in Maven >= 3.5.0 (MNG-6003)
  88. ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
  89. #######
  90. # Install SpotBugs 4.2.2
  91. #######
  92. RUN mkdir -p /opt/spotbugs \
  93. && curl -L -s -S https://github.com/spotbugs/spotbugs/releases/download/4.2.2/spotbugs-4.2.2.tgz \
  94. -o /opt/spotbugs.tgz \
  95. && tar xzf /opt/spotbugs.tgz --strip-components 1 -C /opt/spotbugs \
  96. && chmod +x /opt/spotbugs/bin/*
  97. ENV SPOTBUGS_HOME /opt/spotbugs
  98. #######
  99. # Install Boost 1.72 (1.71 ships with Focal)
  100. #######
  101. # hadolint ignore=DL3003
  102. RUN mkdir -p /opt/boost-library \
  103. && curl -L https://sourceforge.net/projects/boost/files/boost/1.72.0/boost_1_72_0.tar.bz2/download > boost_1_72_0.tar.bz2 \
  104. && mv boost_1_72_0.tar.bz2 /opt/boost-library \
  105. && cd /opt/boost-library \
  106. && tar --bzip2 -xf boost_1_72_0.tar.bz2 \
  107. && cd /opt/boost-library/boost_1_72_0 \
  108. && ./bootstrap.sh --prefix=/usr/ \
  109. && ./b2 --without-python install \
  110. && cd /root \
  111. && rm -rf /opt/boost-library
  112. ######
  113. # Install Google Protobuf 3.7.1 (3.6.1 ships with Focal)
  114. ######
  115. # hadolint ignore=DL3003
  116. RUN mkdir -p /opt/protobuf-src \
  117. && curl -L -s -S \
  118. https://github.com/protocolbuffers/protobuf/releases/download/v3.7.1/protobuf-java-3.7.1.tar.gz \
  119. -o /opt/protobuf.tar.gz \
  120. && tar xzf /opt/protobuf.tar.gz --strip-components 1 -C /opt/protobuf-src \
  121. && cd /opt/protobuf-src \
  122. && ./configure --prefix=/opt/protobuf \
  123. && make "-j$(nproc)" \
  124. && make install \
  125. && cd /root \
  126. && rm -rf /opt/protobuf-src
  127. ENV PROTOBUF_HOME /opt/protobuf
  128. ENV PATH "${PATH}:/opt/protobuf/bin"
  129. ####
  130. # Install pylint and python-dateutil
  131. ####
  132. RUN pip3 install pylint==2.6.0 python-dateutil==2.8.1
  133. ####
  134. # Install bower
  135. ####
  136. # hadolint ignore=DL3008
  137. RUN npm install -g bower@1.8.8
  138. ###
  139. # Install hadolint
  140. ####
  141. RUN curl -L -s -S \
  142. https://github.com/hadolint/hadolint/releases/download/v1.11.1/hadolint-Linux-x86_64 \
  143. -o /bin/hadolint \
  144. && chmod a+rx /bin/hadolint \
  145. && shasum -a 512 /bin/hadolint | \
  146. awk '$1!="734e37c1f6619cbbd86b9b249e69c9af8ee1ea87a2b1ff71dccda412e9dac35e63425225a95d71572091a3f0a11e9a04c2fc25d9e91b840530c26af32b9891ca" {exit(1)}'
  147. ######
  148. # Intel ISA-L 2.29.0
  149. ######
  150. # hadolint ignore=DL3003,DL3008
  151. RUN mkdir -p /opt/isa-l-src \
  152. && apt-get -q update \
  153. && apt-get install -y --no-install-recommends automake yasm \
  154. && apt-get clean \
  155. && curl -L -s -S \
  156. https://github.com/intel/isa-l/archive/v2.29.0.tar.gz \
  157. -o /opt/isa-l.tar.gz \
  158. && tar xzf /opt/isa-l.tar.gz --strip-components 1 -C /opt/isa-l-src \
  159. && cd /opt/isa-l-src \
  160. && ./autogen.sh \
  161. && ./configure \
  162. && make "-j$(nproc)" \
  163. && make install \
  164. && cd /root \
  165. && rm -rf /opt/isa-l-src
  166. ###
  167. # Avoid out of memory errors in builds
  168. ###
  169. ENV MAVEN_OPTS -Xms256m -Xmx3072m
  170. # Skip gpg verification when downloading Yetus via yetus-wrapper
  171. ENV HADOOP_SKIP_YETUS_VERIFICATION true
  172. ###
  173. # Everything past this point is either not needed for testing or breaks Yetus.
  174. # So tell Yetus not to read the rest of the file:
  175. # YETUS CUT HERE
  176. ###
  177. # Add a welcome message and environment checks.
  178. COPY hadoop_env_checks.sh /root/hadoop_env_checks.sh
  179. RUN chmod 755 /root/hadoop_env_checks.sh
  180. # hadolint ignore=SC2016
  181. RUN echo '${HOME}/hadoop_env_checks.sh' >> /root/.bashrc