diff --git a/full/Dockerfile b/full/Dockerfile index 80f6b38..54d3c43 100644 --- a/full/Dockerfile +++ b/full/Dockerfile @@ -7,6 +7,4 @@ RUN set -x \ openssl-dev \ perl \ python3 -COPY znc-entrypoint.sh / - -ENTRYPOINT ["/znc-entrypoint.sh"] +COPY znc-build-modules.sh / diff --git a/full/znc-build-modules.sh b/full/znc-build-modules.sh new file mode 100755 index 0000000..3be0482 --- /dev/null +++ b/full/znc-build-modules.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +# Build modules from source. +if [ -d "${DATADIR}/modules" ]; then + cd "${DATADIR}/modules" || exit 1 + + # Find module sources. + modules=$(find . -name "*.cpp") + + if [ -n "$modules" ]; then + # Build modules. + echo "Building modules $modules..." + /opt/znc/bin/znc-buildmod $modules || exit 1 + fi +fi + diff --git a/full/znc-entrypoint.sh b/full/znc-entrypoint.sh deleted file mode 100755 index e690852..0000000 --- a/full/znc-entrypoint.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh - -# Options. -DATADIR="/znc-data" - -# Build modules from source. -if [ -d "${DATADIR}/modules" ]; then - pushd "${DATADIR}/modules" > /dev/null || exit 1 - - # Find module sources. - modules=$(find "${DATADIR}/modules" -name "*.cpp") - - if [ -n "$modules" ]; then - # Build modules. - echo "Building modules $modules..." - /opt/znc/bin/znc-buildmod $modules - fi - - popd > /dev/null -fi - -exec /opt/znc/bin/znc -f -d /znc-data $@ diff --git a/small/Dockerfile b/small/Dockerfile index 116ece3..cae5209 100644 --- a/small/Dockerfile +++ b/small/Dockerfile @@ -6,7 +6,7 @@ ENV ZNC_VERSION 1.6.4 # :extmodules image installs perl and python3 again, making these modules loadable. # musl silently doesn't support AI_ADDRCONFIG yet, and ZNC doesn't support Happy Eyeballs yet. -# Together they cause very slow connection +# Together they cause very slow connection. ARG CONFIGUREFLAGS="--prefix=/opt/znc --enable-cyrus --enable-perl --enable-python --disable-ipv6" ARG MAKEFLAGS="" @@ -41,9 +41,11 @@ RUN set -x \ && apk del build-dependencies \ && cd / && rm -Rf /znc-src +COPY znc-entrypoint.sh / + USER znc VOLUME /znc-data EXPOSE 6667 -ENTRYPOINT ["/opt/znc/bin/znc", "-f", "-d", "/znc-data"] +ENTRYPOINT ["/znc-entrypoint.sh"] diff --git a/small/znc-entrypoint.sh b/small/znc-entrypoint.sh new file mode 100755 index 0000000..1b1b30c --- /dev/null +++ b/small/znc-entrypoint.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +# Options. +export DATADIR="/znc-data" + +# Make sure $DATADIR is owned by znc user. This effects ownership of the +# mounted directory on the host machine too. +chown -R znc:znc "$DATADIR" || exit 1 +chmod 700 "$DATADIR" || exit 2 + +# Added by znc:full image +if [ -r /znc-build-modules.sh ]; then + /znc-build-modules.sh || exit 3 +fi + +exec /opt/znc/bin/znc --foreground --datadir /znc-data "$@"