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 && \
|
||||
apt-get install -y \
|
||||
git \
|
||||
@@ -9,19 +12,31 @@ RUN apt-get update && \
|
||||
pkg-config \
|
||||
autoconf \
|
||||
automake \
|
||||
libtool && \
|
||||
libtool \
|
||||
libssl-dev && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Build PostgreSQL module
|
||||
RUN cd /tmp && \
|
||||
git clone --depth 1 https://github.com/FreeRADIUS/freeradius-server.git && \
|
||||
cd freeradius-server && \
|
||||
./configure --with-rlm-sql-postgresql && \
|
||||
# Build FreeRADIUS from source
|
||||
WORKDIR /build
|
||||
RUN git clone --depth 1 https://github.com/FreeRADIUS/freeradius-server.git
|
||||
|
||||
WORKDIR /build/freeradius-server
|
||||
|
||||
RUN ./configure --with-rlm-sql-postgresql && \
|
||||
make && \
|
||||
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