mirror of https://github.com/apache/cassandra
91 lines
4.4 KiB
Docker
91 lines
4.4 KiB
Docker
# 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.
|
|
|
|
FROM almalinux:8
|
|
MAINTAINER Apache Cassandra <dev@cassandra.apache.org>
|
|
|
|
# CONTEXT is expected to be cassandra/.build
|
|
|
|
ENV BUILD_HOME=/home/build
|
|
ENV RPM_BUILD_DIR=$BUILD_HOME/rpmbuild
|
|
ENV DIST_DIR=/dist
|
|
ENV CASSANDRA_DIR=$BUILD_HOME/cassandra
|
|
ARG UID_ARG=1000
|
|
ARG GID_ARG=1000
|
|
|
|
LABEL org.cassandra.buildenv=almalinux_build
|
|
|
|
RUN echo "Building with arguments:" \
|
|
&& echo " - DIST_DIR=${DIST_DIR}" \
|
|
&& echo " - BUILD_HOME=${BUILD_HOME}" \
|
|
&& echo " - RPM_BUILD_DIR=${RPM_BUILD_DIR}" \
|
|
&& echo " - CASSANDRA_DIR=${CASSANDRA_DIR}" \
|
|
&& echo " - UID_ARG=${UID_ARG}" \
|
|
&& echo " - GID_ARG=${GID_ARG}"
|
|
|
|
# install deps
|
|
RUN yum -y install \
|
|
ant git make rpm-build sudo python3-pip procps \
|
|
java-11-openjdk-devel java-17-openjdk-devel java-21-openjdk-devel \
|
|
rsync wget curl
|
|
|
|
# Install pandoc from GitHub releases (not available in AlmaLinux 8 repos)
|
|
ARG PANDOC_VERSION="3.9.0.2"
|
|
RUN sh -c '\
|
|
set -ex ;\
|
|
PANDOC_ARCH=amd64 ;\
|
|
[ $(uname -m) = "aarch64" ] && PANDOC_ARCH=arm64 ;\
|
|
PANDOC_VERSION_SHAS="a69abfababda8a56969a254b09f9553a7be89ddec00d4e0fe9fd585d71a67508 b6d21e8f9c3b15744f5a7ab40248019157ed7793875dbe0383d4c82ff572b528" ;\
|
|
PANDOC_TAR="pandoc-${PANDOC_VERSION}-linux-${PANDOC_ARCH}.tar.gz" ;\
|
|
wget -q "https://github.com/jgm/pandoc/releases/download/${PANDOC_VERSION}/${PANDOC_TAR}" --no-check-certificate ;\
|
|
PANDOC_SHA="$(sha256sum ${PANDOC_TAR} | cut -d" " -f1)" ;\
|
|
echo "$PANDOC_VERSION_SHAS" | sed "s/ /\n/g" | grep -q "$PANDOC_SHA" || { echo "SHA256 mismatch for ${PANDOC_TAR} ${PANDOC_SHA}"; exit 1; } ;\
|
|
tar -xzf "${PANDOC_TAR}" -C /usr/local --strip-components=1 ;\
|
|
rm "${PANDOC_TAR}"'
|
|
|
|
RUN until curl -f -S -s --retry 9 --retry-connrefused --retry-delay 1 https://vault.centos.org/7.9.2009/os/x86_64/Packages/ant-junit-1.9.4-2.el7.noarch.rpm -o ant-junit-1.9.4-2.el7.noarch.rpm ; do echo "curl failed… trying again in 10s… " ; sleep 10 ; done
|
|
|
|
RUN rpm -i --nodeps ant-junit-1.9.4-2.el7.noarch.rpm
|
|
|
|
# python3 is needed for the gen-doc target
|
|
RUN pip3 install --upgrade pip
|
|
|
|
# Install Node.js for Antora (documentation generation)
|
|
RUN sh -c '\
|
|
set -ex ;\
|
|
NODE_VERSION="v20.16.0" ;\
|
|
NODE_PLATFORM=x64 ;\
|
|
[ $(uname -m) = "aarch64" ] && NODE_PLATFORM=arm64 ;\
|
|
NODE_VERSION_SHAS="c30af7dfea46de7d8b9b370fa33b8b15440bc93f0a686af8601bbb48b82f16c0 1d9929e72f692179f884cd676b2dfabd879cb77defa7869dc8cfc802619277fb" ;\
|
|
NODE_TAR="node-${NODE_VERSION}-linux-${NODE_PLATFORM}.tar.xz" ;\
|
|
wget -q "https://nodejs.org/dist/${NODE_VERSION}/${NODE_TAR}" --no-check-certificate ;\
|
|
NODE_SHA="$(sha256sum ${NODE_TAR} | cut -d" " -f1)" ;\
|
|
echo "$NODE_VERSION_SHAS" | sed "s/ /\n/g" | grep -q "$NODE_SHA" || { echo "SHA256 mismatch for ${NODE_TAR} ${NODE_SHA}"; exit 1; } ;\
|
|
tar -xJf "${NODE_TAR}" -C /usr/local --strip-components=1 ;\
|
|
rm "${NODE_TAR}" ;\
|
|
ln -s /usr/local/bin/node /usr/local/bin/nodejs'
|
|
|
|
# Install Antora for documentation generation
|
|
RUN npm i -g @antora/cli@2.3 @antora/site-generator-default@2.3 @djencks/asciidoctor-openblock
|
|
|
|
# Prepopulate Maven repository with dependencies from all branches. see _create_user.sh
|
|
COPY docker/_prepopulate_maven_deps.sh /tmp/_prepopulate_maven_deps.sh
|
|
RUN alternatives --set java $(alternatives --display java | grep "family java-11-openjdk" | cut -d' ' -f1)
|
|
RUN alternatives --set javac $(alternatives --display javac | grep "family java-11-openjdk" | cut -d' ' -f1)
|
|
RUN mkdir -p /home/image-cache && chmod -R a+rwx /home/image-cache
|
|
RUN JAVA_HOME=$(readlink -f /usr/bin/javac | sed "s:/bin/javac::") \
|
|
bash /tmp/_prepopulate_maven_deps.sh /home/image-cache/.m2/repository && rm /tmp/_prepopulate_maven_deps.sh
|
|
RUN cp -a /root/.gradle /home/image-cache/.gradle |