From ead34b7ebd8a2f3b81314d72afbc6c8e0cbaa872 Mon Sep 17 00:00:00 2001 From: 2bleere Date: Wed, 30 Jul 2025 09:33:16 -0500 Subject: [PATCH] Updated Dockerfile for multiarch build for amd64 and arm64 downloading netdiscover binary for the right architecture from an alternate repo. Updated base image to bookworm slim and updated legacy ENV variables in Dockerfile. Build with dockerbuildx: docker buildx build --platform linux/amd64,linux/arm64 -t your-image:tag . --- Dockerfile | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6fd833c..63f3ed3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,13 @@ ## ## Build rtpengine from source ## -FROM debian:bookworm AS builder +FROM debian:bookworm-slim AS builder WORKDIR /build ARG TAG_NAME=master -ENV DEBIAN_FRONTEND noninteractive +ARG TARGETARCH +ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get -y install build-essential git curl \ && echo 'man-db man-db/auto-update boolean false' | debconf-set-selections \ @@ -14,18 +15,23 @@ RUN apt-get update && apt-get -y install build-essential git curl \ && cd rtpengine \ && git checkout ${TAG_NAME} \ && apt-get -y build-dep -Ppkg.ngcp-rtpengine.nobcg729 . \ - && dpkg-buildpackage -Ppkg.ngcp-rtpengine.nobcg729 \ - && curl -qL -o /usr/bin/netdiscover https://github.com/CyCoreSystems/netdiscover/releases/download/v1.2.5/netdiscover.linux.amd64 \ + && dpkg-buildpackage -Ppkg.ngcp-rtpengine.nobcg729 -j1 \ + && case ${TARGETARCH} in \ + amd64) ARCH_SUFFIX="linux_amd64" ;; \ + arm64) ARCH_SUFFIX="linux_arm64" ;; \ + *) echo "Unsupported architecture: ${TARGETARCH}" && exit 1 ;; \ + esac \ + && curl -qL -o /usr/bin/netdiscover https://github.com/2bleere/netdiscover/releases/download/latest/netdiscover_${ARCH_SUFFIX} \ && chmod +x /usr/bin/netdiscover ## ## Runner ## -FROM debian:bookworm +FROM debian:bookworm-slim WORKDIR /opt/rtpengine -ENV DEBIAN_FRONTEND noninteractive +ENV DEBIAN_FRONTEND=noninteractive RUN groupadd -r rtpengine && useradd -r -g rtpengine rtpengine