FROM ubuntu:noble AS builder LABEL maintainer="Andreas Neue " ARG VERSION=insp4 ARG CONFIGUREARGS= ARG EXTRASMODULES= ARG BUILD_DEPENDENCIES= # Stage 0: Build from source COPY modules/ /src/modules/ RUN apt update RUN apt -y install gcc g++ make git perl wget gnutls-dev pkg-config $BUILD_DEPENDENCIES RUN groupadd -r -g 10000 ircd && \ useradd -r -g ircd -u 10000 -m -d /inspircd -s /sbin/nologin ircd && \ chown -R ircd:ircd /inspircd RUN git clone --branch $VERSION https://github.com/inspircd/inspircd.git inspircd-src WORKDIR /inspircd-src RUN git checkout $(git describe --abbrev=0 --tags $VERSION) ## Add modules RUN { [ $(ls /src/modules/ | wc -l) -gt 0 ] && cp -r /src/modules/* /inspircd-src/src/modules/ || echo "No modules overwritten/added by repository"; } RUN echo $EXTRASMODULES | xargs --no-run-if-empty ./modulemanager install RUN ./configure --prefix /inspircd --example-dir /inspircd/examples --uid 10000 --gid 10000 RUN echo $CONFIGUREARGS | xargs --no-run-if-empty ./configure RUN make -j`getconf _NPROCESSORS_ONLN` install ## Wipe out vanilla config; entrypoint.sh will handle repopulating it at runtime RUN rm -rf /inspircd/conf/* # Stage 1: Create optimized runtime container FROM dr.dnix.de/baseimage LABEL maintainer="Andreas Neue " ARG RUN_DEPENDENCIES= RUN apt update RUN apt -y upgrade RUN apt -y install sudo $RUN_DEPENDENCIES RUN groupadd -r -g 10000 ircd && \ useradd -r -g ircd -u 10000 -m -d /inspircd -s /sbin/nologin ircd && \ chown -R ircd:ircd /inspircd COPY --chown=ircd:ircd run /etc/my_init.d/ COPY --chown=ircd:ircd entrypoint.sh / COPY --from=builder --chown=ircd:ircd /inspircd/ /inspircd/ #USER ircd EXPOSE 6667 6697 7000 7001 WORKDIR / #HEALTHCHECK \ # --interval=60s \ # --timeout=3s \ # --start-period=60s \ # --retries=3 \ # CMD \ # /usr/bin/nc -z localhost 6667