├── README.md ├── full ├── 30-build-modules.sh └── Dockerfile └── slim ├── Dockerfile ├── entrypoint.sh └── startup-sequence ├── 00-try-sh.sh ├── 01-options.sh ├── 20-chown.sh └── 99-launch.sh /README.md: -------------------------------------------------------------------------------- 1 | This repo is used to update [official Docker ZNC image](https://hub.docker.com/_/znc/) via [this file](https://github.com/docker-library/official-images/blob/master/library/znc). 2 | Also parts of this are reused in [unstable image](https://hub.docker.com/r/zncbouncer/znc-git/). 3 | -------------------------------------------------------------------------------- /full/30-build-modules.sh: -------------------------------------------------------------------------------- 1 | # Build modules from source. 2 | 3 | if [ -d "${DATADIR}/modules" ]; then 4 | cd "${DATADIR}/modules" || exit 11 5 | 6 | # Find module sources. 7 | modules=$(find . -name "*.cpp") 8 | 9 | if [ -n "$modules" ]; then 10 | # Build modules. 11 | echo "Building modules $modules..." 12 | /opt/znc/bin/znc-buildmod $modules || exit 12 13 | fi 14 | 15 | cd / 16 | fi 17 | 18 | -------------------------------------------------------------------------------- /full/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM znc:slim 2 | 3 | # znc:slim removed them. Install them again. 4 | RUN set -x \ 5 | && apk add --no-cache \ 6 | build-base \ 7 | cmake \ 8 | icu-dev \ 9 | openssl-dev \ 10 | perl \ 11 | python3 12 | 13 | COPY 30-build-modules.sh /startup-sequence/ 14 | -------------------------------------------------------------------------------- /slim/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:3.19 2 | 3 | ENV GPG_KEY D5823CACB477191CAC0075555AE420CC0209989E 4 | 5 | # modperl and modpython are built, but won't be loadable. 6 | # :full image installs perl and python3 again, making these modules loadable. 7 | 8 | ARG CMAKEFLAGS="-DCMAKE_INSTALL_PREFIX=/opt/znc -DWANT_CYRUS=YES -DWANT_PERL=YES -DWANT_PYTHON=YES -DWANT_ARGON=YES" 9 | ARG MAKEFLAGS="" 10 | 11 | ENV ZNC_VERSION 1.9.1 12 | 13 | RUN set -x \ 14 | && adduser -S znc \ 15 | && addgroup -S znc \ 16 | && apk add --no-cache --virtual runtime-dependencies \ 17 | argon2-libs \ 18 | boost \ 19 | ca-certificates \ 20 | cyrus-sasl \ 21 | icu \ 22 | icu-data-full \ 23 | openssl \ 24 | su-exec \ 25 | tini \ 26 | tzdata \ 27 | && apk add --no-cache --virtual build-dependencies \ 28 | argon2-dev \ 29 | boost-dev \ 30 | build-base \ 31 | cmake \ 32 | curl \ 33 | cyrus-sasl-dev \ 34 | gettext \ 35 | gnupg \ 36 | icu-dev \ 37 | openssl-dev \ 38 | perl-dev \ 39 | python3-dev \ 40 | && mkdir /znc-src && cd /znc-src \ 41 | && curl -fsSL "https://znc.in/releases/archive/znc-${ZNC_VERSION}.tar.gz" -o znc.tgz \ 42 | && curl -fsSL "https://znc.in/releases/archive/znc-${ZNC_VERSION}.tar.gz.sig" -o znc.tgz.sig \ 43 | && export GNUPGHOME="$(mktemp -d)" \ 44 | && gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "${GPG_KEY}" \ 45 | && gpg --batch --verify znc.tgz.sig znc.tgz \ 46 | && rm -rf "$GNUPGHOME" \ 47 | && tar -zxf znc.tgz --strip-components=1 \ 48 | && mkdir build && cd build \ 49 | && cmake .. ${CMAKEFLAGS} \ 50 | && make $MAKEFLAGS \ 51 | && make install \ 52 | && apk del build-dependencies \ 53 | && cd / && rm -rf /znc-src 54 | 55 | COPY entrypoint.sh / 56 | COPY startup-sequence /startup-sequence/ 57 | 58 | VOLUME /znc-data 59 | 60 | ENTRYPOINT ["/entrypoint.sh"] 61 | -------------------------------------------------------------------------------- /slim/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | for f in /startup-sequence/*; do 4 | source "$f" || exit 1 5 | done 6 | -------------------------------------------------------------------------------- /slim/startup-sequence/00-try-sh.sh: -------------------------------------------------------------------------------- 1 | # "docker run -ti znc sh" should work, according to 2 | # https://github.com/docker-library/official-images 3 | 4 | if [ "${1:0:1}" != '-' ]; then 5 | exec "$@" 6 | fi 7 | -------------------------------------------------------------------------------- /slim/startup-sequence/01-options.sh: -------------------------------------------------------------------------------- 1 | # Might be overriden in some later file, when using "FROM znc" 2 | 3 | DATADIR="/znc-data" 4 | -------------------------------------------------------------------------------- /slim/startup-sequence/20-chown.sh: -------------------------------------------------------------------------------- 1 | # Make sure $DATADIR is owned by znc user. This affects ownership of the 2 | # mounted directory on the host machine too. 3 | # Also allow the container to be started with `--user`. 4 | 5 | if [ "$(id -u)" = '0' ]; then 6 | chown -R znc:znc "$DATADIR" || exit 1 7 | chmod 700 "$DATADIR" || exit 2 8 | exec su-exec znc:znc /entrypoint.sh "$@" 9 | fi 10 | -------------------------------------------------------------------------------- /slim/startup-sequence/99-launch.sh: -------------------------------------------------------------------------------- 1 | # ZNC itself responds to SIGTERM, and reaps its children, but whatever was 2 | # started via *shell module is not guaranteed to reap their children. 3 | # That's why using tini. 4 | 5 | exec /sbin/tini -- /opt/znc/bin/znc --foreground --datadir "$DATADIR" "$@" 6 | --------------------------------------------------------------------------------