|
| 1 | +# Auto generated for ubuntu24 |
| 2 | +# from scripts/docker/m4/docker.deb.m4 |
| 3 | +# |
| 4 | +# Rebuild this file with `make docker.ubuntu24.regen` |
| 5 | +# |
| 6 | +ARG from=ubuntu:24.04 |
| 7 | +FROM ${from} AS build |
| 8 | + |
| 9 | +ARG DEBIAN_FRONTEND=noninteractive |
| 10 | + |
| 11 | +# |
| 12 | +# Install build tools |
| 13 | +# |
| 14 | +RUN apt-get update |
| 15 | +RUN apt-get install -y devscripts equivs git quilt gcc curl |
| 16 | + |
| 17 | +# |
| 18 | +# Set up NetworkRADIUS extras repository |
| 19 | +# |
| 20 | +RUN install -d -o root -g root -m 0755 /etc/apt/keyrings \ |
| 21 | + && curl -o /etc/apt/keyrings/packages.networkradius.com.asc "https://packages.inkbridgenetworks.com/pgp/packages%40networkradius.com" \ |
| 22 | + && echo "deb [signed-by=/etc/apt/keyrings/packages.networkradius.com.asc] http://packages.networkradius.com/extras/ubuntu/noble noble main" > /etc/apt/sources.list.d/networkradius-extras.list \ |
| 23 | + && apt-get update |
| 24 | + |
| 25 | +# |
| 26 | +# Create build directory |
| 27 | +# |
| 28 | +RUN mkdir -p /usr/local/src/repositories/freeradius-server |
| 29 | +WORKDIR /usr/local/src/repositories/freeradius-server/ |
| 30 | + |
| 31 | +# |
| 32 | +# Copy the FreeRADIUS directory in |
| 33 | +# |
| 34 | +COPY . . |
| 35 | + |
| 36 | +# |
| 37 | +# Clean up tree - we want to build from the latest commit, not from |
| 38 | +# any cruft left around on the local system |
| 39 | +# |
| 40 | +RUN git clean -fdxx \ |
| 41 | + && git reset --hard HEAD |
| 42 | + |
| 43 | +# |
| 44 | +# Build libkqueue from source on non-amd64 architectures. |
| 45 | +# The NetworkRADIUS extras repository only provides amd64 packages. |
| 46 | +# |
| 47 | +RUN if [ "$(dpkg --print-architecture)" != "amd64" ]; then \ |
| 48 | + apt-get install -y cmake && \ |
| 49 | + git clone --depth 1 https://github.com/mheily/libkqueue.git && \ |
| 50 | + cd libkqueue && \ |
| 51 | + cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=lib . && \ |
| 52 | + make && cpack -G DEB && dpkg -i *.deb && \ |
| 53 | + cp *.deb /usr/local/src/repositories/ && \ |
| 54 | + cd .. && rm -rf libkqueue; \ |
| 55 | + fi |
| 56 | + |
| 57 | +# |
| 58 | +# Install build dependencies |
| 59 | +# Debian sid fails if debian/control doesn't exist due to an issue |
| 60 | +# in one of the included make files, so we create a blank file. |
| 61 | +# |
| 62 | +RUN if [ -e ./debian/control.in ]; then \ |
| 63 | + touch -t 202001010000 debian/control; \ |
| 64 | + debian/rules debian/control; \ |
| 65 | + fi; \ |
| 66 | + echo 'y' | mk-build-deps -irt'apt-get -yV' debian/control |
| 67 | + |
| 68 | +# |
| 69 | +# Build the server |
| 70 | +# |
| 71 | +RUN make -j$(nproc) deb |
| 72 | + |
| 73 | +# |
| 74 | +# Clean environment and run the server |
| 75 | +# |
| 76 | +FROM ${from} |
| 77 | +ARG DEBIAN_FRONTEND=noninteractive |
| 78 | + |
| 79 | +COPY --from=build /usr/local/src/repositories/*.deb /tmp/ |
| 80 | + |
| 81 | +# |
| 82 | +# Set up NetworkRADIUS extras repository |
| 83 | +# Reuse the signing key from the build stage instead of fetching it again |
| 84 | +# |
| 85 | +COPY --from=build /etc/apt/keyrings/packages.networkradius.com.asc /etc/apt/keyrings/packages.networkradius.com.asc |
| 86 | +RUN echo "deb [signed-by=/etc/apt/keyrings/packages.networkradius.com.asc] http://packages.networkradius.com/extras/ubuntu/noble noble main" > /etc/apt/sources.list.d/networkradius-extras.list |
| 87 | + |
| 88 | +ARG freerad_uid=101 |
| 89 | +ARG freerad_gid=101 |
| 90 | + |
| 91 | +RUN groupadd -g ${freerad_gid} -r freerad \ |
| 92 | + && useradd -u ${freerad_uid} -g freerad -r -M -d /etc/freeradius -s /usr/sbin/nologin freerad \ |
| 93 | + && apt-get update \ |
| 94 | + && apt-get install -y /tmp/*.deb \ |
| 95 | + && apt-get install -y \ |
| 96 | + # Build essentials |
| 97 | + build-essential \ |
| 98 | + cmake \ |
| 99 | + make \ |
| 100 | + git \ |
| 101 | + vim \ |
| 102 | + # SSL / compression / memory libs |
| 103 | + libssl-dev \ |
| 104 | + libbrotli-dev \ |
| 105 | + libtalloc-dev \ |
| 106 | + # Google perf tools |
| 107 | + libgoogle-perftools-dev \ |
| 108 | + google-perftools \ |
| 109 | + # Valgrind / heap profiling |
| 110 | + valgrind \ |
| 111 | + heaptrack \ |
| 112 | + # Utilities |
| 113 | + less \ |
| 114 | + psmisc \ |
| 115 | + # kcachegrind - GUI callgrind viewer (requires display/X11 forwarding or VNC) |
| 116 | + # Pulls in heavy KDE/Qt dependencies (~200MB+). |
| 117 | + # To use: run with `docker run -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix` |
| 118 | + kcachegrind \ |
| 119 | + kio \ |
| 120 | + libkf5iconthemes5 \ |
| 121 | + libkf5parts5 \ |
| 122 | + libkf5textwidgets5 \ |
| 123 | + libqt5gui5 \ |
| 124 | + libqt5widgets5 \ |
| 125 | + && apt-get clean \ |
| 126 | + && rm -r /var/lib/apt/lists/* /tmp/*.deb \ |
| 127 | + \ |
| 128 | + && ln -s /etc/freeradius /etc/raddb |
| 129 | + |
| 130 | +WORKDIR / |
| 131 | +COPY scripts/docker/etc/docker-entrypoint.sh.deb docker-entrypoint.sh |
| 132 | +RUN chmod +x docker-entrypoint.sh |
| 133 | + |
| 134 | +EXPOSE 1812/udp 1813/udp |
| 135 | +ENTRYPOINT ["/docker-entrypoint.sh"] |
| 136 | +CMD ["freeradius"] |
0 commit comments