Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
1 changed file
with
95 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
ARG from=centos:centos7 | ||
FROM ${from} as build | ||
|
||
# | ||
# Install build tools | ||
# | ||
RUN yum groupinstall -y "Development Tools" | ||
RUN yum install -y rpmdevtools | ||
RUN yum install -y openssl | ||
|
||
# | ||
# Create build directory | ||
# | ||
RUN mkdir -p /usr/local/src/repositories | ||
WORKDIR /usr/local/src/repositories | ||
|
||
# | ||
# Shallow clone the FreeRADIUS source | ||
# | ||
ARG source=https://github.com/FreeRADIUS/freeradius-server.git | ||
ARG release=v3.0.x | ||
|
||
RUN git clone --depth 1 --single-branch --branch ${release} ${source} | ||
WORKDIR freeradius-server | ||
|
||
# | ||
# Other requirements | ||
# | ||
|
||
# Use LTB's openldap packages intead of the distribution version to avoid linking against NSS | ||
RUN echo $'[ltb-project]\n\ | ||
name=LTB project packages\n\ | ||
baseurl=https://ltb-project.org/rpm/$releasever/$basearch\n\ | ||
enabled=1\n\ | ||
gpgcheck=1\n\ | ||
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-LTB-project'\ | ||
> /etc/yum.repos.d/ltb-project.repo | ||
RUN rpm --import https://ltb-project.org/lib/RPM-GPG-KEY-LTB-project | ||
|
||
# EPEL repository for freetds and hiredis | ||
RUN yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm | ||
|
||
# | ||
# Install build dependencies | ||
# | ||
RUN [ -e redhat/freeradius.spec ] && yum-builddep -y redhat/freeradius.spec | ||
|
||
# | ||
# Create RPM build environment | ||
# | ||
ENV BUILDDIR=/root/rpmbuild | ||
RUN rpmdev-setuptree | ||
|
||
RUN ./configure | ||
RUN make freeradius-server-$(cat VERSION).tar.bz2 | ||
RUN cp freeradius-server-$(cat VERSION).tar.bz2 $BUILDDIR/SOURCES/ | ||
RUN cp -r redhat/* $BUILDDIR/SOURCES/ | ||
RUN cp -r redhat/freeradius.spec $BUILDDIR/SPECS/ | ||
WORKDIR $BUILDDIR | ||
|
||
# | ||
# Build the server | ||
# | ||
ENV QA_RPATHS=0x0003 | ||
RUN rpmbuild -bb --define '_release $release' "$BUILDDIR/SPECS/freeradius.spec" | ||
|
||
RUN mkdir /root/rpms | ||
RUN mv $BUILDDIR/RPMS/*/*.rpm /root/rpms/ | ||
|
||
# | ||
# Clean environment and run the server | ||
# | ||
FROM ${from} | ||
COPY --from=build /root/rpms /tmp/ | ||
|
||
# Use LTB's openldap packages intead of the distribution version to avoid linking against NSS | ||
RUN echo $'[ltb-project]\n\ | ||
name=LTB project packages\n\ | ||
baseurl=https://ltb-project.org/rpm/$releasever/$basearch\n\ | ||
enabled=1\n\ | ||
gpgcheck=1\n\ | ||
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-LTB-project'\ | ||
> /etc/yum.repos.d/ltb-project.repo \ | ||
&& rpm --import https://ltb-project.org/lib/RPM-GPG-KEY-LTB-project \ | ||
\ | ||
# EPEL repository for freetds and hiredis | ||
&& yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm \ | ||
\ | ||
&& yum install -y /tmp/*.rpm | ||
|
||
COPY docker-entrypoint.sh / | ||
|
||
EXPOSE 1812/udp 1813/udp | ||
ENTRYPOINT ["/docker-entrypoint.sh"] | ||
CMD ["radiusd"] |