Debian Codegraph @

scripts/docker/dists/centos7/Dockerfile

raw
1 # Auto generated for centos7
2 # from scripts/docker/m4/Dockerfile.rpm.m4
3 #
4 # Rebuild this file with `make docker.centos7.regen`
5 #
6 ARG from=centos:7
7 FROM ${from} AS build
8
9 #
10 # CentOS 7 is now EOL, so we need to fix up the repo source
11 #
12 RUN sed -i "s/^mirrorlist/#mirrorlist/g" /etc/yum.repos.d/CentOS-*
13 RUN sed -i "s|#\s*baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g" /etc/yum.repos.d/CentOS-*
14
15
16
17
18 #
19 # Install build tools
20 #
21 RUN yum groupinstall -y "Development Tools"
22 RUN yum install -y rpmdevtools
23 RUN yum install -y openssl
24
25
26 #
27 # Create build directory
28 #
29 RUN mkdir -p /usr/local/src/repositories/freeradius-server
30 WORKDIR /usr/local/src/repositories/freeradius-server/
31
32 #
33 # Copy the FreeRADIUS directory in
34 #
35 COPY . .
36
37 #
38 # Clean up tree - we want to build from the latest commit, not from
39 # any cruft left around on the local system
40 #
41 RUN git clean -fdxx \
42 && git reset --hard HEAD
43
44 ARG release
45 RUN [ -z "$release" ] || git checkout ${release} ; \
46 git status ; \
47 git log -1 --oneline
48
49 #
50 # Other requirements
51 #
52
53 # Use LTB's openldap packages intead of the distribution version to avoid linking against NSS
54 RUN echo $'[ltb-project]\n\
55 name=LTB project packages\n\
56 baseurl=https://ltb-project.org/rpm/$releasever/$basearch\n\
57 enabled=1\n\
58 gpgcheck=1\n\
59 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-LTB-project'\
60 > /etc/yum.repos.d/ltb-project.repo
61 RUN rpm --import https://ltb-project.org/lib/RPM-GPG-KEY-LTB-project
62
63 # Enable EPEL repository for freetds and hiredis
64
65 RUN echo $'[epel]\n\
66 name=Extra Packages for Enterprise Linux 7 - $basearch\n\
67 metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch&infra=$infra&content=$contentdir\n\
68 failovermethod=priority\n\
69 enabled=1\n\
70 gpgcheck=1\n\
71 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7'\
72 > /etc/yum.repos.d/epel.repo
73 RUN rpm --import https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7
74
75
76 #
77 # Install build dependencies
78 #
79 # Run twice, it doesn't always get everything with one invocation
80 #
81 RUN [ -e redhat/freeradius.spec ] && \
82 yum-builddep -y redhat/freeradius.spec && \
83 yum-builddep -y redhat/freeradius.spec
84
85 #
86 # Create RPM build environment
87 #
88 ENV BUILDDIR=/root/rpmbuild
89 RUN rpmdev-setuptree
90
91 RUN ./configure
92 RUN cp VERSION /VERSION
93 RUN make freeradius-server-$(cat /VERSION).tar.bz2
94 RUN cp freeradius-server-$(cat /VERSION).tar.bz2 $BUILDDIR/SOURCES/
95 RUN cp -r redhat/* $BUILDDIR/SOURCES/
96 RUN sed -i "s/^Version:.*/Version: $(cat /VERSION)/" redhat/freeradius.spec
97 RUN cp -r redhat/freeradius.spec $BUILDDIR/SPECS/
98 WORKDIR $BUILDDIR
99
100 #
101 # Build the server
102 #
103 ENV QA_RPATHS=0x0003
104 RUN rpmbuild -bb --define "_release $(cat /VERSION)" "$BUILDDIR/SPECS/freeradius.spec"
105
106 RUN mkdir /root/rpms
107 RUN mv $BUILDDIR/RPMS/*/*.rpm /root/rpms/
108
109 #
110 # Clean environment and run the server
111 #
112 FROM ${from}
113
114 COPY --from=build /root/rpms /tmp/
115
116 #
117 # CentOS 7 is now EOL, so we need to fix up the repo source
118 #
119 RUN sed -i "s/^mirrorlist/#mirrorlist/g" /etc/yum.repos.d/CentOS-*
120 RUN sed -i "s|#\s*baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g" /etc/yum.repos.d/CentOS-*
121
122
123 # Use LTB's openldap packages intead of the distribution version to avoid linking against NSS
124 RUN echo $'[ltb-project]\n\
125 name=LTB project packages\n\
126 baseurl=https://ltb-project.org/rpm/$releasever/$basearch\n\
127 enabled=1\n\
128 gpgcheck=1\n\
129 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-LTB-project'\
130 > /etc/yum.repos.d/ltb-project.repo \
131 && rpm --import https://ltb-project.org/lib/RPM-GPG-KEY-LTB-project
132
133 # EPEL repository for freetds and hiredis
134
135 RUN echo $'[epel]\n\
136 name=Extra Packages for Enterprise Linux 7 - $basearch\n\
137 metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch&infra=$infra&content=$contentdir\n\
138 failovermethod=priority\n\
139 enabled=1\n\
140 gpgcheck=1\n\
141 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7'\
142 > /etc/yum.repos.d/epel.repo
143 RUN rpm --import https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7 \
144 \
145 && yum install -y /tmp/*.rpm
146
147 WORKDIR /
148 COPY scripts/docker//etc/docker-entrypoint.sh.rpm docker-entrypoint.sh
149 RUN chmod +x docker-entrypoint.sh
150
151 EXPOSE 1812/udp 1813/udp
152 ENTRYPOINT ["/docker-entrypoint.sh"]
153 CMD ["radiusd"]