1FROM centos:centos7
2
3#
4#  Install devtools like make and git and the EPEL
5#  repository for freetds and hiredis
6#
7RUN yum update -y
8RUN yum install -y rpmdevtools openssl epel-release git yum-utils rsync
9
10#
11#  Install GCC that has the requisite support for C11 keywords and atomics
12#
13RUN yum install -y centos-release-scl
14RUN yum install -y devtoolset-8-gcc devtoolset-8-gcc-c++
15ENV CC=/opt/rh/devtoolset-8/root/usr/bin/gcc
16
17#
18#  Remove the CentOS-SCLo repo which is apparently not valid?
19#  See: https://bugs.centos.org/view.php?id=14773
20#
21RUN rm /etc/yum.repos.d/CentOS-SCLo-scl-rh.repo
22RUN rm /etc/yum.repos.d/CentOS-SCLo-scl.repo
23
24#
25#  Documentation build dependecies
26#
27
28#  - doxygen & JSON.pm
29RUN yum install -y doxygen graphviz perl-JSON
30#  - antora (npm needed)
31RUN curl -sL https://rpm.nodesource.com/setup_10.x | bash -
32RUN yum install -y nodejs
33RUN npm i -g @antora/cli@2.1 @antora/site-generator-default@2.1
34#  - pandoc
35RUN curl -o - -L $(curl -s https://api.github.com/repos/jgm/pandoc/releases/latest | grep "browser_download_url.*tar.gz" | cut -d '"' -f 4) | tar xzvf - -C /tmp/
36# "
37RUN mv /tmp/pandoc-*/bin/* /usr/local/bin
38#  - asciidoctor
39RUN yum install -y rubygems-devel
40RUN gem install asciidoctor
41
42#
43#  Setup a src dir in /usr/local
44#
45RUN mkdir -p /usr/local/src/repositories
46WORKDIR /usr/local/src/repositories
47
48#
49#  Use LTB's openldap packages intead of the distribution version to avoid linking against NSS
50#
51RUN echo $'[ltb-project]\n\
52name=LTB project packages\n\
53baseurl=https://ltb-project.org/rpm/$releasever/$basearch\n\
54enabled=1\n\
55gpgcheck=1\n\
56gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-LTB-project'\
57> /etc/yum.repos.d/ltb-project.repo
58RUN rpm --import https://ltb-project.org/lib/RPM-GPG-KEY-LTB-project
59
60#
61#  Shallow clone the FreeRADIUS source
62#
63WORKDIR /usr/local/src/repositories
64ARG source=https://github.com/FreeRADIUS/freeradius-server.git
65RUN git clone --depth 1 --no-single-branch ${source}
66
67#
68#  Install build dependencies for all branches from v3 onwards
69#  Nodesource has issues (no SRPMS in some repos) and is not needed here
70#
71WORKDIR freeradius-server
72RUN for i in $(git for-each-ref --format='%(refname:short)' refs/remotes/origin 2>/dev/null | sed -e 's#origin/##' | egrep "^(v[3-9]*\.[0-9x]*\.x|master)$");\
73	do \
74		git checkout $i; \
75		[ -e redhat/freeradius.spec ] && yum-builddep --disablerepo="nodesource*" -y redhat/freeradius.spec; \
76	done
77
78#
79#  Which is required by fixture setup utilities
80#
81RUN yum install -y which
82
83#
84#  Explicitly install libnl3-devel which is required for the EAP tests
85#
86RUN yum install -y libnl3-devel
87
88#
89#  Create the RPM build tree
90#
91ENV BUILDDIR=/root/rpmbuild
92RUN rpmdev-setuptree
93