ARG PTLIB_VERSION="2.18.6" ARG PTLIB_VERSION_PATH="v3.18 Cygni/Stable 6/ptlib-2.18.6" ARG OPAL_VERSION="3.18.6" ARG OPAL_VERSION_PATH="v3.18 Cygni/Stable 6/opal-3.18.6" ARG T38MODEM_VERSION="4.6.2" FROM docker.io/debian:12.8-slim AS builder ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update \ && apt-get upgrade -y \ && apt-get install -y --no-install-recommends ca-certificates build-essential pkg-config wget libssl-dev libsrtp2-dev libspandsp-dev WORKDIR /usr/src RUN mkdir /opt/t38modem ENV PKG_CONFIG_PATH=/opt/t38modem/lib/pkgconfig ENV LD_LIBRARY_PATH=/opt/t38modem/lib ARG PTLIB_VERSION ARG PTLIB_VERSION_PATH RUN wget -q -O- "https://sourceforge.net/projects/opalvoip/files/${PTLIB_VERSION_PATH}.tar.bz2" \ | tar xj \ && cd "ptlib-${PTLIB_VERSION}" \ && CPPFLAGS="-O3 -flto=auto" LDFLAGS="-O3 -flto=auto" ./configure --prefix=/opt/t38modem \ && make -j$(nproc) \ && make install \ && rm -rf "/usr/src/ptlib-${PTLIB_VERSION}" ARG OPAL_VERSION ARG OPAL_VERSION_PATH RUN wget -q -O- "https://sourceforge.net/projects/opalvoip/files/${OPAL_VERSION_PATH}.tar.bz2" \ | tar xj \ && cd "opal-${OPAL_VERSION}" \ && CPPFLAGS="-O3" ./configure --prefix=/opt/t38modem \ && make -j$(nproc) \ && make install \ && rm -rf "/usr/src/opal-${OPAL_VERSION}" ARG T38MODEM_VERSION RUN wget -q -O- "https://github.com/hehol/t38modem/archive/refs/tags/${T38MODEM_VERSION}.tar.gz" \ | tar xz \ && cd "t38modem-${T38MODEM_VERSION}" \ && CPPFLAGS="-O3 -flto=auto -Wno-narrowing" LDFLAGS="-O3 -flto=auto" make \ && mv t38modem /opt/t38modem/bin \ && rm -rf "/usr/src/t38modem-${T38MODEM_VERSION}" FROM docker.io/debian:12.8-slim AS runner LABEL maintainer="dominic@dergrimm.net" \ org.opencontainers.image.title="t38modem" \ org.opencontainers.image.description="t38modem bridged over socat TCP" \ org.opencontainers.image.authors="Dominic Grimm" \ org.opencontainers.image.source="https://git.dergrimm.net/dergrimm/linux-fax-stack.git" ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update \ && apt-get upgrade -y \ && apt-get install -y ca-certificates socat libssl-dev libsrtp2-dev libspandsp-dev \ && apt-get clean -y \ && apt-get autoremove -y \ && apt-get autoclean -y \ && rm -rf /tmp/* \ && rm -rf /var/lib/apt/lists/* WORKDIR /usr/local/t38modem COPY --from=builder /opt/t38modem/lib /usr/local/t38modem/lib COPY --from=builder /opt/t38modem/bin/t38modem /usr/local/t38modem/bin/t38modem COPY services services COPY start.sh . RUN chmod +x /usr/local/t38modem/services/t38modem.sh /usr/local/t38modem/services/socat.sh /usr/local/t38modem/start.sh RUN rm -rf /tmp/* ENV PATH="$PATH:/usr/local/t38modem/bin" ENV PREFIX="/usr/local/t38modem" ENV LD_LIBRARY_PATH="/usr/local/t38modem/lib" ARG PTLIB_VERSION ARG OPAL_VERSION ENV PTLIBPLUGINDIR="/usr/local/t38modem/lib/ptlib-${PTLIB_VERSION}:/usr/local/t38modem/lib/opal-${OPAL_VERSION}" ENTRYPOINT [ "/usr/local/t38modem/start.sh" ]