diff --git a/containers/kiwix-serve/Dockerfile b/containers/kiwix-serve/Dockerfile deleted file mode 100644 index 17167e5..0000000 --- a/containers/kiwix-serve/Dockerfile +++ /dev/null @@ -1,55 +0,0 @@ -# kiwix-serve container -# Downloads pre-built binary from kiwix mirror - -ARG CONTAINER_APP_VERSION=3.8.2 - -FROM alpine:3.22 - -ARG TARGETPLATFORM -ARG CONTAINER_APP_VERSION -ARG KIWIX_VERSION=${CONTAINER_APP_VERSION} - -RUN set -e && \ - apk --no-cache add dumb-init curl && \ - # Detect architecture - use TARGETPLATFORM if set, otherwise detect from uname - if [ -n "$TARGETPLATFORM" ]; then \ - echo "TARGETPLATFORM: $TARGETPLATFORM"; \ - case "$TARGETPLATFORM" in \ - linux/arm64*) ARCH="aarch64" ;; \ - linux/amd64*) ARCH="x86_64" ;; \ - *) ARCH="" ;; \ - esac; \ - else \ - echo "TARGETPLATFORM not set, detecting from uname..."; \ - UNAME_ARCH=$(uname -m); \ - echo "uname -m: $UNAME_ARCH"; \ - case "$UNAME_ARCH" in \ - aarch64|arm64) ARCH="aarch64" ;; \ - x86_64) ARCH="x86_64" ;; \ - *) ARCH="" ;; \ - esac; \ - fi && \ - if [ -z "$ARCH" ]; then \ - echo "ERROR: Unsupported architecture"; \ - exit 1; \ - fi && \ - url="http://mirror.download.kiwix.org/release/kiwix-tools/kiwix-tools_linux-$ARCH-$KIWIX_VERSION.tar.gz" && \ - echo "URL: $url" && \ - curl -k -L $url | tar -xz -C /usr/local/bin/ --strip-components 1 && \ - apk del curl - -ARG CONTAINER_APP_VERSION -LABEL org.opencontainers.image.title="kiwix-serve" -LABEL org.opencontainers.image.description="Kiwix content server for offline ZIM files" -LABEL org.opencontainers.image.version="${CONTAINER_APP_VERSION}" -LABEL org.opencontainers.image.source="https://forge.eblu.me/eblume/blumeops" -LABEL org.opencontainers.image.vendor="blumeops" - -EXPOSE 80 - -# Run as non-root -RUN adduser -D -u 1000 kiwix -USER kiwix - -ENTRYPOINT ["/usr/bin/dumb-init", "--"] -CMD ["/bin/sh", "-c", "echo 'Use: kiwix-serve [options] ' && kiwix-serve --help"] diff --git a/containers/kiwix-serve/container.py b/containers/kiwix-serve/container.py new file mode 100644 index 0000000..1e6596e --- /dev/null +++ b/containers/kiwix-serve/container.py @@ -0,0 +1,53 @@ +"""Kiwix content server — native Dagger build. + +Downloads pre-built kiwix-tools binary from the Kiwix mirror. +Multi-arch support (aarch64, x86_64) via platform detection. +""" + +import dagger + +from blumeops.containers import alpine_runtime, oci_labels + +VERSION = "3.8.2" + +MIRROR = "http://mirror.download.kiwix.org/release/kiwix-tools" + + +async def build(src: dagger.Directory) -> dagger.Container: + runtime = alpine_runtime( + extra_apk=["dumb-init", "curl"], + uid=1000, + gid=1000, + username="kiwix", + ) + + # Download and install the pre-built binary for the target platform + runtime = runtime.with_exec( + [ + "sh", + "-c", + f"ARCH=$(uname -m) && " + f'case "$ARCH" in aarch64|arm64) ARCH=aarch64;; x86_64) ARCH=x86_64;; *) echo "Unsupported: $ARCH"; exit 1;; esac && ' + f'curl -fsSL "{MIRROR}/kiwix-tools_linux-$ARCH-{VERSION}.tar.gz" | tar -xz -C /usr/local/bin/ --strip-components 1', + ] + ).with_exec(["apk", "del", "curl"]) + + runtime = oci_labels( + runtime, + title="kiwix-serve", + description="Kiwix content server for offline ZIM files", + version=VERSION, + ) + + return ( + runtime.with_exposed_port(80) + .with_user("1000") + .with_entrypoint(["/usr/bin/dumb-init", "--"]) + .with_default_args( + args=[ + "/bin/sh", + "-c", + "echo 'Use: kiwix-serve [options] ' && kiwix-serve --help", + ] + ) + ) diff --git a/docs/changelog.d/+kiwix-dagger-migration.infra.md b/docs/changelog.d/+kiwix-dagger-migration.infra.md new file mode 100644 index 0000000..462e040 --- /dev/null +++ b/docs/changelog.d/+kiwix-dagger-migration.infra.md @@ -0,0 +1 @@ +Migrated kiwix-serve container from Dockerfile to native Dagger build, bumping Alpine base from 3.22 to 3.23. diff --git a/service-versions.yaml b/service-versions.yaml index 62d8835..6d5226f 100644 --- a/service-versions.yaml +++ b/service-versions.yaml @@ -209,7 +209,7 @@ services: - name: kiwix type: argocd - last-reviewed: 2026-03-05 + last-reviewed: 2026-04-17 current-version: "3.8.2" upstream-source: https://github.com/kiwix/kiwix-tools/releases