Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 104 additions & 0 deletions dev-support/docker/Dockerfile_ubuntu_24_riscv64
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Dockerfile for installing the necessary dependencies for building Hadoop.
# See BUILDING.txt.

FROM ubuntu:noble

WORKDIR /root

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

#####
# Disable suggests/recommends
#####
RUN echo APT::Install-Recommends "0"\; > /etc/apt/apt.conf.d/10disableextras
RUN echo APT::Install-Suggests "0"\; >> /etc/apt/apt.conf.d/10disableextras

ENV DEBIAN_FRONTEND=noninteractive
ENV DEBCONF_TERSE=true

######
# Platform package dependency resolver
######
COPY pkg-resolver pkg-resolver
RUN chmod a+x pkg-resolver/*.sh pkg-resolver/*.py \
&& chmod a+r pkg-resolver/*.json

######
# Install packages from apt
######
# hadolint ignore=DL3008,SC2046
RUN apt-get -q update \
&& apt-get -q install -y --no-install-recommends wget apt-transport-https gpg gpg-agent gawk ca-certificates \
&& apt-get -q install -y --no-install-recommends python3 \
&& apt-get -q install -y --no-install-recommends $(pkg-resolver/resolve.py ubuntu:noble::riscv64) \
&& apt-get clean \
&& update-java-alternatives -s java-1.17.0-openjdk-riscv64 \
&& rm -rf /var/lib/apt/lists/*

RUN locale-gen en_US.UTF-8
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'
ENV PYTHONIOENCODING=utf-8

######
# Set env vars required to build Hadoop
######
ENV MAVEN_HOME=/opt/maven
ENV PATH="${PATH}:${MAVEN_HOME}/bin"
# JAVA_HOME must be set in Maven >= 3.5.0 (MNG-6003)
ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk-riscv64

#######
# Set env vars for SpotBugs 4.2.2
#######
ENV SPOTBUGS_HOME=/opt/spotbugs

#######
# Set env vars for Google Protobuf 3.25.5
#######
ENV PROTOBUF_HOME=/opt/protobuf
ENV PATH="${PATH}:/opt/protobuf/bin"

###
# Avoid out of memory errors in builds
###
ENV MAVEN_OPTS="-Xms256m -Xmx3072m"

# Skip gpg verification when downloading Yetus via yetus-wrapper
ENV HADOOP_SKIP_YETUS_VERIFICATION=true

####
# Install packages
####
RUN pkg-resolver/install-maven.sh ubuntu:noble::riscv64
RUN pkg-resolver/install-spotbugs.sh ubuntu:noble::riscv64
RUN pkg-resolver/install-boost.sh ubuntu:noble::riscv64
RUN pkg-resolver/install-protobuf.sh ubuntu:noble::riscv64
RUN pkg-resolver/install-hadolint.sh ubuntu:noble::riscv64

###
# Everything past this point is either not needed for testing or breaks Yetus.
# So tell Yetus not to read the rest of the file:
# YETUS CUT HERE
###

# Add a welcome message and environment checks.
COPY hadoop_env_checks.sh /root/hadoop_env_checks.sh
RUN chmod 755 /root/hadoop_env_checks.sh
# hadolint ignore=SC2016
RUN echo '${HOME}/hadoop_env_checks.sh' >> /root/.bashrc
23 changes: 23 additions & 0 deletions dev-support/docker/hadoop_env_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,31 @@ End-of-message

# -------------------------------------------------------

function tips {
CPU_ARCH=$(echo "$MACHTYPE" | cut -d- -f1)
if [[ "$CPU_ARCH" == "riscv64" ]]; then
cat <<End-of-message

You must install 'com.google.protobuf:protoc:exe:linux-riscv64:3.25.5'
into maven local repository (~/.m2) manually on riscv64 platform.

mvn install:install-file \\
-DgroupId=com.google.protobuf \\
-DartifactId=protoc \\
-Dversion=3.25.5 \\
-Dclassifier=linux-riscv64 \\
-Dpackaging=exe \\
-Dfile=${PROTOBUF_HOME}/bin/protoc

End-of-message
fi
}

# -------------------------------------------------------

showWelcome
warnIfLowMemory
failIfUserIsRoot
tips

# -------------------------------------------------------
20 changes: 12 additions & 8 deletions dev-support/docker/pkg-resolver/install-protobuf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,29 +27,33 @@ if [ $? -eq 1 ]; then
exit 1
fi

default_version="3.21.12"
default_version="3.25.5"
version_to_install=$default_version
if [ -n "$2" ]; then
version_to_install="$2"
fi

if [ "$version_to_install" != "3.21.12" ]; then
if [ "$version_to_install" != "3.25.5" ]; then
echo "WARN: Don't know how to install version $version_to_install, installing the default version $default_version instead"
version_to_install=$default_version
fi

if [ "$version_to_install" == "3.21.12" ]; then
if [ "$version_to_install" == "3.25.5" ]; then
# hadolint ignore=DL3003
mkdir -p /opt/protobuf-src &&
curl -L -s -S \
https://github.com/protocolbuffers/protobuf/archive/refs/tags/v3.21.12.tar.gz \
https://github.com/protocolbuffers/protobuf/archive/refs/tags/v3.25.5.tar.gz \
-o /opt/protobuf.tar.gz &&
tar xzf /opt/protobuf.tar.gz --strip-components 1 -C /opt/protobuf-src &&
mkdir -p /opt/abseil-cpp-src &&
curl -L -s -S \
https://github.com/abseil/abseil-cpp/archive/refs/tags/20230802.1.tar.gz \
-o /opt/abseil-cpp.tar.gz &&
tar xzf /opt/abseil-cpp.tar.gz --strip-components 1 -C /opt/protobuf-src/third_party/abseil-cpp &&
cd /opt/protobuf-src &&
./autogen.sh &&
./configure --prefix=/opt/protobuf &&
make "-j$(nproc)" &&
make install &&
cmake -S . -B build -Dprotobuf_BUILD_TESTS=OFF &&
cmake --build build --parallel $(nproc) &&
cmake --install build --prefix /opt/protobuf &&
cd /root &&
rm -rf /opt/protobuf-src
else
Expand Down
Loading