From 6185c5dd4b0e5a4dddbe8643a40665ccb8bc1cfe Mon Sep 17 00:00:00 2001 From: Luke Tainton Date: Sat, 28 Feb 2026 15:06:07 +0000 Subject: [PATCH] fix(dockerfile): resolve hadolint warnings and optimize image layers - Set SHELL directive with pipefail for Alpine image - Combine RUN commands to reduce layer count - Remove redundant build stage alias - Add OCI metadata labels (title, description) - Pin all apk package versions Signed-off-by: Luke Tainton --- Dockerfile | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1a031df..ff2bdc2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,20 +1,22 @@ -FROM alpine:3.23.3 AS build -LABEL maintainer="Luke Tainton " -LABEL org.opencontainers.image.source="https://git.tainton.uk/repos/docker-radius" - -FROM build AS webproc +FROM alpine:3.23.3 AS webproc +SHELL ["/bin/ash", "-o", "pipefail", "-c"] ENV WEBPROCVERSION=0.4.0 ENV WEBPROCURL=https://github.com/jpillora/webproc/releases/download/v$WEBPROCVERSION/webproc_"$WEBPROCVERSION"_linux_amd64.gz -RUN apk add --no-cache curl -RUN curl -sL $WEBPROCURL | gzip -d - > /usr/local/bin/webproc -RUN chmod +x /usr/local/bin/webproc +RUN apk add --no-cache curl=8.17.0-r1 && \ + curl -sL $WEBPROCURL | gzip -d - > /usr/local/bin/webproc && \ + chmod +x /usr/local/bin/webproc -FROM build -RUN apk --no-cache add freeradius +FROM alpine:3.23.3 +LABEL maintainer="Luke Tainton " +LABEL org.opencontainers.image.source="https://git.tainton.uk/repos/docker-radius" +LABEL org.opencontainers.image.description="FreeRADIUS server with web administration interface" +LABEL org.opencontainers.image.title="docker-radius" +SHELL ["/bin/ash", "-o", "pipefail", "-c"] +RUN apk --no-cache add freeradius=3.0.27-r2 COPY --from=webproc /usr/local/bin/webproc /usr/local/bin/webproc -ADD clients.conf /etc/raddb/clients.conf -ADD users /etc/raddb/users -ADD radiusd.conf /etc/raddb/radiusd.conf +COPY clients.conf /etc/raddb/clients.conf +COPY users /etc/raddb/users +COPY radiusd.conf /etc/raddb/radiusd.conf RUN chmod -R o-w /etc/raddb/ ENTRYPOINT ["webproc","-o","restart","-c","/etc/raddb/users","-c", "/etc/raddb/clients.conf", "-c", "/etc/raddb/radiusd.conf","--","radiusd","-f","-l","stdout"] EXPOSE 1812/udp 1813/udp 8080/tcp