blob: 47a7e87bd413818de38a04963e7cc0afe098fdd7 [file] [log] [blame]
FROM centos:7.0.1406
ENV BUILD_HOME=/home/build
ENV RPM_BUILD_DIR=$BUILD_HOME/rpmbuild
ENV RPM_DIST_DIR=/dist
ENV CASSANDRA_DIR=$BUILD_HOME/cassandra
LABEL org.cassandra.buildenv=centos
VOLUME ${RPM_DIST_DIR}
# install deps
RUN yum -y install \
ant \
ant-junit \
epel-release \
git \
java-1.7.0-openjdk-devel \
java-1.8.0-openjdk-devel \
java-11-openjdk-devel \
make \
rpm-build \
sudo
# fix yum error after installing epel-release:
# Cannot retrieve metalink for repository: epel/x86_64. Please verify its path and try again
# https://stackoverflow.com/questions/48320850/installing-epel-repository-on-centos-7-breaks-yum-functionality
RUN yum -y update curl --disablerepo=epel
# via epel-releases
RUN yum -y install python2-pip
# install ssl enabled urllib for retrieving python packages
# this will produce some ssl related warnings, which will be resolved once the package has been installed
RUN pip install urllib3[secure]
# upgrade to modern pip version
RUN pip install --upgrade pip
# install Sphinx to generate docs
RUN pip install \
Sphinx \
sphinx_rtd_theme
# create and change to build user
RUN adduser build
RUN echo "build ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/build && \
chmod 0440 /etc/sudoers.d/build
USER build
RUN mkdir -p $RPM_BUILD_DIR/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
# Clone Cassandra and cache maven artifacts
ARG CASSANDRA_GIT_URL=https://gitbox.apache.org/repos/asf/cassandra.git
RUN git clone ${CASSANDRA_GIT_URL} ${CASSANDRA_DIR}
WORKDIR $CASSANDRA_DIR
RUN ant maven-ant-tasks-retrieve-build
COPY build-rpms.sh $BUILD_HOME/