diff --git a/full/Dockerfile b/full/Dockerfile index 6ce778b..409bf55 100644 --- a/full/Dockerfile +++ b/full/Dockerfile @@ -1,8 +1,5 @@ FROM znc:slim -# I don't know what it should do. It works for me without this line, but not for @tianon -USER root - # znc:slim removed them. Install them again. RUN set -x \ && apk add --no-cache \ @@ -12,6 +9,3 @@ RUN set -x \ perl \ python3 COPY znc-build-modules.sh / - -# Revert the USER root line above -USER znc diff --git a/slim/Dockerfile b/slim/Dockerfile index d3e785b..8bfe4e3 100644 --- a/slim/Dockerfile +++ b/slim/Dockerfile @@ -20,6 +20,7 @@ RUN set -x \ cyrus-sasl \ icu \ openssl \ + sudo \ tini \ && apk add --no-cache --virtual build-dependencies \ build-base \ @@ -47,7 +48,6 @@ RUN set -x \ COPY docker-entrypoint.sh / -USER znc VOLUME /znc-data ENTRYPOINT ["/docker-entrypoint.sh"] diff --git a/slim/docker-entrypoint.sh b/slim/docker-entrypoint.sh index 5b06172..ce4d6dd 100755 --- a/slim/docker-entrypoint.sh +++ b/slim/docker-entrypoint.sh @@ -9,11 +9,6 @@ fi # Options. DATADIR="/znc-data" -# Make sure $DATADIR is owned by znc user. This affects ownership of the -# mounted directory on the host machine too. -chown -R znc:znc "$DATADIR" || exit 1 -chmod 700 "$DATADIR" || exit 2 - # This file is added by znc:full image if [ -r /znc-build-modules.sh ]; then source /znc-build-modules.sh || exit 3 @@ -21,6 +16,12 @@ fi cd / +# Make sure $DATADIR is owned by znc user. This affects ownership of the +# mounted directory on the host machine too. +chown -R znc:znc "$DATADIR" || exit 1 +chmod 700 "$DATADIR" || exit 2 + # ZNC itself responds to SIGTERM, and reaps its children, but whatever was # started via *shell module is not guaranteed to reap their children. -exec /sbin/tini -- /opt/znc/bin/znc --foreground --datadir "$DATADIR" "$@" +# That's why using tini. +exec /sbin/tini -- sudo --user znc /opt/znc/bin/znc --foreground --datadir "$DATADIR" "$@"