cassandra/.build/docker/centos7-build.docker

87 lines
3.5 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 centos:7
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
ENV ANT_VERSION=1.10.14
ARG UID_ARG=1000
ARG GID_ARG=1000
LABEL org.cassandra.buildenv=centos
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 \
java-11-openjdk-devel \
make \
rpm-build \
sudo \
python3-pip \
rsync
RUN until curl -f -S -s --retry 9 --retry-delay 1 http://mirror.centos.org/centos/7/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
# try first downloads.a.o and then archive.a.o (as the latter has a 5GB per IP daily limit)
RUN until curl -f -S -s --retry 9 --retry-delay 1 https://downloads.apache.org/ant/binaries/apache-ant-${ANT_VERSION}-bin.tar.gz -o apache-ant-${ANT_VERSION}-bin.tar.gz || curl -f -S -s --retry 9 --retry-delay 1 http://archive.apache.org/dist/ant/binaries/apache-ant-${ANT_VERSION}-bin.tar.gz -o apache-ant-${ANT_VERSION}-bin.tar.gz ; do echo "curl failed… trying again in 10s… " ; sleep 10 ; done
RUN rm -rf /etc/ant.conf
RUN tar xvf apache-ant-${ANT_VERSION}-bin.tar.gz -C /opt
RUN ln -sfn /opt/apache-ant-${ANT_VERSION} /opt/ant
RUN sh -c 'echo ANT_HOME=/opt/ant >> /etc/environment'
RUN ln -sfn /opt/ant/bin/ant /usr/bin/ant
# jdk17 latest on x64
RUN if [ "$(arch)" == "x86_64" ] ; then \
until curl -f -S -s --retry 9 --retry-delay 1 https://download.oracle.com/java/17/latest/jdk-17_linux-x64_bin.tar.gz -o openjdk-17_bin.tar.gz ; do \
echo "curl failed… trying again in 10s… " ; sleep 10 ; \
done \
fi
# jdk17 latest on arm
RUN if [ "$(arch)" == "aarch64" ] ; then \
until curl -f -S -s --retry 9 --retry-delay 1 https://download.oracle.com/java/17/latest/jdk-17_linux-aarch64_bin.tar.gz -o openjdk-17_bin.tar.gz ; do \
echo "curl failed… trying again in 10s… " ; sleep 10 ; \
done \
fi
RUN tar xvf openjdk-17_bin.tar.gz
RUN mv jdk-17* /opt/jdk-17
RUN alternatives --install /usr/bin/java java /opt/jdk-17/bin/java 3 --family java-17-openjdk.$(arch)
RUN alternatives --install /usr/bin/javac javac /opt/jdk-17/bin/javac 3 --family java-17-openjdk.$(arch)
# python3 is needed for the gen-doc target
RUN pip3 install --upgrade pip