Restructure entry point

master
Alexey Sokolov 7 years ago
parent 7328475370
commit 295769ebba

@ -7,6 +7,4 @@ RUN set -x \
openssl-dev \
perl \
python3
COPY znc-entrypoint.sh /
ENTRYPOINT ["/znc-entrypoint.sh"]
COPY 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

@ -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 $@

@ -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"]

@ -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 "$@"
Loading…
Cancel
Save