Refactor Dockerfile to separate build and runtime stages for FreeRADIUS with PostgreSQL
Build and Push Docker Image to Gitea Container Registry / build-and-push (push) Failing after 2m53s
Build and Push Docker Image to Gitea Container Registry / build-and-push (push) Failing after 2m53s
This commit is contained in:
+27
-12
@@ -1,6 +1,9 @@
|
|||||||
FROM freeradius/freeradius-server:latest
|
###############################################
|
||||||
|
# Stage 1 — Build FreeRADIUS with PostgreSQL
|
||||||
|
###############################################
|
||||||
|
FROM debian:stable AS builder
|
||||||
|
|
||||||
# Build dependencies
|
# Install build dependencies
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install -y \
|
apt-get install -y \
|
||||||
git \
|
git \
|
||||||
@@ -9,19 +12,31 @@ RUN apt-get update && \
|
|||||||
pkg-config \
|
pkg-config \
|
||||||
autoconf \
|
autoconf \
|
||||||
automake \
|
automake \
|
||||||
libtool && \
|
libtool \
|
||||||
|
libssl-dev && \
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Build PostgreSQL module
|
# Build FreeRADIUS from source
|
||||||
RUN cd /tmp && \
|
WORKDIR /build
|
||||||
git clone --depth 1 https://github.com/FreeRADIUS/freeradius-server.git && \
|
RUN git clone --depth 1 https://github.com/FreeRADIUS/freeradius-server.git
|
||||||
cd freeradius-server && \
|
|
||||||
./configure --with-rlm-sql-postgresql && \
|
WORKDIR /build/freeradius-server
|
||||||
|
|
||||||
|
RUN ./configure --with-rlm-sql-postgresql && \
|
||||||
make && \
|
make && \
|
||||||
make install
|
make install
|
||||||
|
|
||||||
# Runtime: point FreeRADIUS to the compiled module directory
|
|
||||||
RUN ln -s /usr/local/lib/freeradius /usr/lib/freeradius
|
|
||||||
|
|
||||||
# Runtime: use the compiled config directory
|
###############################################
|
||||||
RUN rm -rf /etc/freeradius && ln -s /usr/local/etc/raddb /etc/freeradius
|
# Stage 2 — Runtime image
|
||||||
|
###############################################
|
||||||
|
FROM freeradius/freeradius-server:latest
|
||||||
|
|
||||||
|
# Copy compiled modules and configs from builder
|
||||||
|
COPY --from=builder /usr/local/lib/freeradius /usr/lib/freeradius
|
||||||
|
COPY --from=builder /usr/local/etc/raddb /etc/freeradius
|
||||||
|
|
||||||
|
# Optional: ensure SQL module is enabled
|
||||||
|
RUN ln -s /etc/freeradius/mods-available/sql /etc/freeradius/mods-enabled/sql
|
||||||
|
|
||||||
|
# FreeRADIUS runs automatically via base image entrypoint
|
||||||
|
|||||||
Reference in New Issue
Block a user