From e24afd9f98d202f69a8d809a6ebb7d1407dced6d Mon Sep 17 00:00:00 2001 From: "Stanislav N. aka pztrn" Date: Fri, 24 Jul 2026 20:15:08 +0500 Subject: [PATCH] Initial commit. --- .woodpecker/build.yaml | 16 ++++++++ Dockerfile | 58 +++++++++++++++++++++++++++ README.md | 64 ++++++++++++++++++++++++++++++ configuration/s6/.s6-svscan/finish | 5 +++ configuration/s6/innd/finish | 3 ++ configuration/s6/innd/run | 3 ++ configuration/s6/nnrpd/finish | 3 ++ configuration/s6/nnrpd/run | 3 ++ start-innd.sh | 17 ++++++++ 9 files changed, 172 insertions(+) create mode 100644 .woodpecker/build.yaml create mode 100644 Dockerfile create mode 100644 README.md create mode 100755 configuration/s6/.s6-svscan/finish create mode 100755 configuration/s6/innd/finish create mode 100755 configuration/s6/innd/run create mode 100755 configuration/s6/nnrpd/finish create mode 100755 configuration/s6/nnrpd/run create mode 100755 start-innd.sh diff --git a/.woodpecker/build.yaml b/.woodpecker/build.yaml new file mode 100644 index 0000000..fcd5042 --- /dev/null +++ b/.woodpecker/build.yaml @@ -0,0 +1,16 @@ +--- +when: + - event: ["tag"] + +steps: + - name: "Build tagged container" + image: "code.pztrn.name/containers/mirror/docker:29.6.2-dind" + environment: + DRONE_USER_PASSWORD: + from_secret: DRONE_USER_PASSWORD + commands: + - docker login -u drone -p $${DRONE_USER_PASSWORD} code.pztrn.name + - docker build --pull -t code.pztrn.name/containers/inn2:$${CI_COMMIT_TAG} -f Dockerfile . + - docker push code.pztrn.name/containers/inn2:$${CI_COMMIT_TAG} + volumes: + - /var/run/docker.sock:/var/run/docker.sock diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..478f552 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,58 @@ +FROM code.pztrn.name/containers/mirror/alpine:3.24.1 AS build + +ENV PERL_MM_USE_DEFAULT=1 +RUN apk add --no-cache \ + bison \ + build-base \ + curl \ + gawk \ + gd-dev \ + gnupg \ + libgd \ + krb5-dev \ + openssl \ + openssl-dev \ + perl \ + perl-dev \ + perl-utils \ + python3 \ + python3-dev \ + s6 \ + shadow \ + sqlite-dev \ + tar \ + zlib-dev && \ + cpan -T GD MIME::Parser && \ + rm -rf /root/.cpan + + +ARG VERSION=2.7.4 +RUN curl -sL https://github.com/InterNetNews/inn/releases/download/${VERSION}/inn-${VERSION}.tar.gz | tar xz + +WORKDIR /inn-${VERSION} +RUN ./configure --prefix=/inn2 --with-zlib --with-openssl --with-sqlite --with-krb5 --with-perl --with-python && \ + make && \ + sed -i 's/#domain:/domain: news.localhost/' site/inn.conf && \ + make install + +RUN sed -i 's/#\(tlscapath:\)/\1/' /inn2/etc/inn.conf && \ + sed -i 's/#\(tlscertfile:\)/\1/' /inn2/etc/inn.conf && \ + sed -i 's/#\(tlskeyfile:\)/\1/' /inn2/etc/inn.conf && \ + mv /inn2/etc /inn2/etc-default && \ + mv /inn2/db /inn2/db-default && \ + mv /inn2/spool /inn2/spool-default + +COPY configuration /etc +COPY start-innd.sh /start-innd + +RUN groupmod -g 600 news && usermod -u 600 -g 600 -d /inn2 news && chown -R news:news /inn2 && chown -R news:news /etc/s6 + +WORKDIR /inn2 +ENV PATH=/inn2/bin:$PATH +ENV PERL_MM_USE_DEFAULT=1 +USER news +EXPOSE 119 +EXPOSE 563 +VOLUME [ "/inn2/db", "/inn2/spool", "/inn2/log" ] + +CMD ["/usr/bin/s6-svscan", "/etc/s6"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..6fcef8d --- /dev/null +++ b/README.md @@ -0,0 +1,64 @@ +# inn2 Docker container + +This repository holds files neccessary to build inn2 (InterNet News 2), a NNTP server. + +This container is based on [greenbender's image](https://github.com/greenbender/inn-docker). + +## Usage + +Configuration files are described on [inn official site](https://www.eyrie.org/~eagle/software/inn/) (select proper version from right sidebar). + +Using this container with compose: + +```yaml +--- +services: + inn: + image: "code.pztrn.name/containers/inn2" + restart: always + ports: + - 119:119 + - 563:563 + volumes: + - "./data/db:/inn2/db" + - "./data/etc:/inn2/etc" + - "./data/log:/inn2/log" + - "./data/run:/inn2/run" + - "./data/spool:/inn2/spool" + - "./data/tmp:/inn2/tmp" + ulimits: + nofile: + soft: 65535 + hard: 65535 +``` + +## Cronjobs + +There is a section in documentation about cron jobs you should configure. This docker image currently isn't supporting these, so configure it separately with lines like: + +```shell +0 3 * * * docker compose run inn news.daily expireover lowmark +``` + +## Versioning + +Image versioning follows official inn2 versions with additional optional version postfix added to indicate image fixes for particular version. + +Examples: + +* 2.7.4-3 - inn version 2.7.4 and 3 additional fixes applied to container. +* 2.7.6 - inn version 2.7.6 without additional container fixes. + +## Data directories and permissions + +Configuration is kept in `/inn2/etc`, mount it in your local filesystem. Entrypoint script will copy default configuration for you if missing. + +This container exposes `/inn2/db`, `/inn2/spool`, `/inn2/log` as volumes, so you may either: + +* Leave as is, Docker will create separate volume for your data. +* Mount volume somewhere, like in compose example above. + +inn2 is launched as UID/GID 600 in container, so chown directories properly according to your Docker configuration: + +* If you're not using userns isolation - use `chown 600:600`. +* If you're using it - use `600 + id from /etc/subuid`, e.g. if you're using default Docker remapping this could be `chown 100600:100600`. diff --git a/configuration/s6/.s6-svscan/finish b/configuration/s6/.s6-svscan/finish new file mode 100755 index 0000000..804b105 --- /dev/null +++ b/configuration/s6/.s6-svscan/finish @@ -0,0 +1,5 @@ +#!/bin/sh + +for file in /etc/s6/*/finish; do + $file +done diff --git a/configuration/s6/innd/finish b/configuration/s6/innd/finish new file mode 100755 index 0000000..50f9103 --- /dev/null +++ b/configuration/s6/innd/finish @@ -0,0 +1,3 @@ +#!/bin/sh + +kill "$(cat /inn2/run/innd.pid)" diff --git a/configuration/s6/innd/run b/configuration/s6/innd/run new file mode 100755 index 0000000..9d5f21a --- /dev/null +++ b/configuration/s6/innd/run @@ -0,0 +1,3 @@ +#!/bin/execlineb -P + +/start-innd diff --git a/configuration/s6/nnrpd/finish b/configuration/s6/nnrpd/finish new file mode 100755 index 0000000..9a0b04e --- /dev/null +++ b/configuration/s6/nnrpd/finish @@ -0,0 +1,3 @@ +#!/bin/sh + +kill "$(cat /inn2/run/nnrpd-563.pid)" diff --git a/configuration/s6/nnrpd/run b/configuration/s6/nnrpd/run new file mode 100755 index 0000000..3c011eb --- /dev/null +++ b/configuration/s6/nnrpd/run @@ -0,0 +1,3 @@ +#!/bin/execlineb -P + +nnrpd -D -f -p 563 -S diff --git a/start-innd.sh b/start-innd.sh new file mode 100755 index 0000000..6774a6f --- /dev/null +++ b/start-innd.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +if [ ! -f "/inn2/etc/inn.conf" ]; then + cp -r /inn2/etc-default/* /inn2/etc +fi + +if [ ! -f "/inn2/db/history" ]; then + cp -r /inn2/db-default/* /inn2/db +fi + +if [ ! -d "/inn2/spool/articles" ]; then + cp -r /inn2/spool-default/* /inn2/spool +fi + +cd /inn2 + +/inn2/bin/innd -f