Dockerfile 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. ######
  29. # Platform package dependency resolver
  30. ######
  31. COPY pkg-resolver pkg-resolver
  32. RUN chmod a+x pkg-resolver/*.sh pkg-resolver/*.py \
  33. && chmod a+r pkg-resolver/*.json
  34. ######
  35. # Install packages from apt
  36. ######
  37. # hadolint ignore=DL3008,SC2046
  38. RUN apt-get -q update \
  39. && apt-get -q install -y --no-install-recommends wget apt-transport-https gpg gpg-agent gawk ca-certificates \
  40. && apt-get -q install -y --no-install-recommends python3 \
  41. && echo "deb https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" > /etc/apt/sources.list.d/adoptium.list \
  42. && wget -q -O - https://packages.adoptium.net/artifactory/api/gpg/key/public > /etc/apt/trusted.gpg.d/adoptium.asc \
  43. && apt-get -q update \
  44. && apt-get -q install -y --no-install-recommends $(pkg-resolver/resolve.py ubuntu:focal) \
  45. && apt-get clean \
  46. && update-java-alternatives -s java-1.8.0-openjdk-amd64 \
  47. && rm -rf /var/lib/apt/lists/*
  48. RUN locale-gen en_US.UTF-8
  49. ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'
  50. ENV PYTHONIOENCODING=utf-8
  51. ######
  52. # Set env vars required to build Hadoop
  53. ######
  54. ENV MAVEN_HOME /usr
  55. # JAVA_HOME must be set in Maven >= 3.5.0 (MNG-6003)
  56. ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
  57. #######
  58. # Set env vars for SpotBugs 4.2.2
  59. #######
  60. ENV SPOTBUGS_HOME /opt/spotbugs
  61. #######
  62. # Set env vars for Google Protobuf 3.21.12
  63. #######
  64. ENV PROTOBUF_HOME /opt/protobuf
  65. ENV PATH "${PATH}:/opt/protobuf/bin"
  66. ###
  67. # Avoid out of memory errors in builds
  68. ###
  69. ENV MAVEN_OPTS -Xms256m -Xmx3072m
  70. # Skip gpg verification when downloading Yetus via yetus-wrapper
  71. ENV HADOOP_SKIP_YETUS_VERIFICATION true
  72. ####
  73. # Install packages
  74. ####
  75. RUN pkg-resolver/install-common-pkgs.sh
  76. RUN pkg-resolver/install-spotbugs.sh ubuntu:focal
  77. RUN pkg-resolver/install-boost.sh ubuntu:focal
  78. RUN pkg-resolver/install-protobuf.sh ubuntu:focal
  79. RUN pkg-resolver/install-hadolint.sh ubuntu:focal
  80. RUN pkg-resolver/install-intel-isa-l.sh ubuntu:focal
  81. ###
  82. # Everything past this point is either not needed for testing or breaks Yetus.
  83. # So tell Yetus not to read the rest of the file:
  84. # YETUS CUT HERE
  85. ###
  86. # Add a welcome message and environment checks.
  87. COPY hadoop_env_checks.sh /root/hadoop_env_checks.sh
  88. RUN chmod 755 /root/hadoop_env_checks.sh
  89. # hadolint ignore=SC2016
  90. RUN echo '${HOME}/hadoop_env_checks.sh' >> /root/.bashrc