mirror of https://github.com/kiwix/kiwix-tools.git
commit
b064796c2d
@ -0,0 +1,61 @@
|
|||||||
|
name: Docker
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
version:
|
||||||
|
description: Specific version to build (overrides on-master and tag-pattern)
|
||||||
|
required: false
|
||||||
|
default: ''
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-push-kiwix-tools:
|
||||||
|
name: Deploy kiwix-tools Docker Image
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: build and publish kiwix-tools
|
||||||
|
uses: openzim/docker-publish-action@v5
|
||||||
|
with:
|
||||||
|
image-name: kiwix/kiwix-tools
|
||||||
|
credentials: |
|
||||||
|
DOCKERIO_USERNAME=${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
DOCKERIO_TOKEN=${{ secrets.DOCKERHUB_PASSWORD }}
|
||||||
|
GHCRIO_USERNAME=${{ secrets.GHCR_USERNAME }}
|
||||||
|
GHCRIO_TOKEN=${{ secrets.GHCR_TOKEN }}
|
||||||
|
context: docker
|
||||||
|
latest-on-tag: true
|
||||||
|
build-args:
|
||||||
|
VERSION={tag}
|
||||||
|
platforms: |
|
||||||
|
linux/amd64
|
||||||
|
linux/arm/v7
|
||||||
|
linux/arm64
|
||||||
|
restrict-to: kiwix/kiwix-tools
|
||||||
|
manual-tag: ${{ github.event.inputs.version }}
|
||||||
|
|
||||||
|
build-and-push-kiwix-serve:
|
||||||
|
name: Deploy kiwix-serve Docker Image
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
needs: build-and-push-kiwix-tools
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: build and publish kiwix-serve
|
||||||
|
uses: openzim/docker-publish-action@v5
|
||||||
|
with:
|
||||||
|
image-name: kiwix/kiwix-serve
|
||||||
|
credentials: |
|
||||||
|
DOCKERIO_USERNAME=${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
DOCKERIO_TOKEN=${{ secrets.DOCKERHUB_PASSWORD }}
|
||||||
|
GHCRIO_USERNAME=${{ secrets.GHCR_USERNAME }}
|
||||||
|
GHCRIO_TOKEN=${{ secrets.GHCR_TOKEN }}
|
||||||
|
context: docker/server
|
||||||
|
latest-on-tag: true
|
||||||
|
build-args:
|
||||||
|
VERSION={tag}
|
||||||
|
platforms: |
|
||||||
|
linux/amd64
|
||||||
|
linux/arm/v7
|
||||||
|
linux/arm64
|
||||||
|
restrict-to: kiwix/kiwix-tools
|
||||||
|
manual-tag: ${{ github.event.inputs.version }}
|
||||||
@ -0,0 +1,79 @@
|
|||||||
|
name: Packages
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-deb:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
distro: [ubuntu-hirsute, ubuntu-groovy, ubuntu-focal]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
# Determine which PPA we should upload to
|
||||||
|
- name: PPA
|
||||||
|
id: ppa
|
||||||
|
run: |
|
||||||
|
if [[ $REF == refs/tags* ]]
|
||||||
|
then
|
||||||
|
echo "::set-output name=ppa::kiwixteam/release"
|
||||||
|
else
|
||||||
|
echo "::set-output name=ppa::kiwixteam/dev"
|
||||||
|
fi
|
||||||
|
env:
|
||||||
|
REF: ${{ github.ref }}
|
||||||
|
|
||||||
|
- uses: legoktm/gh-action-auto-dch@master
|
||||||
|
with:
|
||||||
|
fullname: Kiwix builder
|
||||||
|
email: release+launchpad@kiwix.org
|
||||||
|
distro: ${{ matrix.distro }}
|
||||||
|
|
||||||
|
- uses: legoktm/gh-action-build-deb@ubuntu-hirsute
|
||||||
|
if: matrix.distro == 'ubuntu-hirsute'
|
||||||
|
name: Build package for ubuntu-hirsute
|
||||||
|
id: build-ubuntu-hirsute
|
||||||
|
with:
|
||||||
|
args: --no-sign
|
||||||
|
ppa: ${{ steps.ppa.outputs.ppa }}
|
||||||
|
|
||||||
|
- uses: legoktm/gh-action-build-deb@ubuntu-groovy
|
||||||
|
if: matrix.distro == 'ubuntu-groovy'
|
||||||
|
name: Build package for ubuntu-groovy
|
||||||
|
id: build-ubuntu-groovy
|
||||||
|
with:
|
||||||
|
args: --no-sign
|
||||||
|
ppa: ${{ steps.ppa.outputs.ppa }}
|
||||||
|
|
||||||
|
- uses: legoktm/gh-action-build-deb@ubuntu-focal
|
||||||
|
if: matrix.distro == 'ubuntu-focal'
|
||||||
|
name: Build package for ubuntu-focal
|
||||||
|
id: build-ubuntu-focal
|
||||||
|
with:
|
||||||
|
args: --no-sign
|
||||||
|
ppa: ${{ steps.ppa.outputs.ppa }}
|
||||||
|
|
||||||
|
- uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: Packages for ${{ matrix.distro }}
|
||||||
|
path: output
|
||||||
|
|
||||||
|
- uses: legoktm/gh-action-dput@master
|
||||||
|
name: Upload dev package
|
||||||
|
# Only upload on pushes to master
|
||||||
|
if: github.event_name == 'push' && github.event.ref == 'refs/heads/master' && startswith(matrix.distro, 'ubuntu-')
|
||||||
|
with:
|
||||||
|
gpg_key: ${{ secrets.LAUNCHPAD_GPG }}
|
||||||
|
repository: ppa:kiwixteam/dev
|
||||||
|
packages: output/*_source.changes
|
||||||
|
|
||||||
|
- uses: legoktm/gh-action-dput@master
|
||||||
|
name: Upload release package
|
||||||
|
# Only upload on pushes to master or tag
|
||||||
|
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') && startswith(matrix.distro, 'ubuntu-')
|
||||||
|
with:
|
||||||
|
gpg_key: ${{ secrets.LAUNCHPAD_GPG }}
|
||||||
|
repository: ppa:kiwixteam/release
|
||||||
|
packages: output/*_source.changes
|
||||||
|
|
||||||
@ -0,0 +1,5 @@
|
|||||||
|
kiwix-tools (0.0.0) unstable; urgency=medium
|
||||||
|
|
||||||
|
* Initial release
|
||||||
|
|
||||||
|
-- Kunal Mehta <legoktm@debian.org> Mon, 13 Jul 2020 17:21:11 -0700
|
||||||
@ -0,0 +1,27 @@
|
|||||||
|
Source: kiwix-tools
|
||||||
|
Section: utils
|
||||||
|
Priority: optional
|
||||||
|
Maintainer: Kiwix team <kiwix@kiwix.org>
|
||||||
|
Build-Depends: debhelper-compat (= 13),
|
||||||
|
libkiwix-dev (>= 9.3.0~),
|
||||||
|
libmicrohttpd-dev,
|
||||||
|
meson,
|
||||||
|
pkg-config,
|
||||||
|
zlib1g-dev
|
||||||
|
Standards-Version: 4.5.0
|
||||||
|
Homepage: https://github.com/kiwix/kiwix-tools
|
||||||
|
Rules-Requires-Root: no
|
||||||
|
|
||||||
|
Package: kiwix-tools
|
||||||
|
Architecture: any
|
||||||
|
Depends: ${misc:Depends}, ${shlibs:Depends}
|
||||||
|
Description: collection of Kiwix tools
|
||||||
|
kiwix-tools is a collection of various command-line tools used to help
|
||||||
|
users interact with and manage ZIM files. It includes:
|
||||||
|
* kiwix-serve is a standalone HTTP server for serving ZIM files
|
||||||
|
over the network.
|
||||||
|
* kiwix-manage allows one to manage the content of the Kiwix library (an
|
||||||
|
XML file listing available ZIM files).
|
||||||
|
* kiwix-read allows for reading ZIM files from the command-line.
|
||||||
|
* kiwix-search allows one to find articles in a ZIM file using fulltext
|
||||||
|
search patterns.
|
||||||
@ -0,0 +1 @@
|
|||||||
|
See COPYING in the repository root.
|
||||||
@ -0,0 +1,5 @@
|
|||||||
|
#!/usr/bin/make -f
|
||||||
|
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
|
||||||
|
|
||||||
|
%:
|
||||||
|
dh $@
|
||||||
@ -0,0 +1 @@
|
|||||||
|
3.0 (native)
|
||||||
@ -0,0 +1,33 @@
|
|||||||
|
# declare build option ARCH if not using buildx
|
||||||
|
ARG ARCH=
|
||||||
|
# declare version to build image for
|
||||||
|
ARG VERSION=
|
||||||
|
|
||||||
|
# alpine is a multi-arch image
|
||||||
|
FROM alpine:3
|
||||||
|
LABEL org.opencontainers.image.source https://github.com/openzim/kiwix-tools
|
||||||
|
|
||||||
|
# TARGETARCH is injected by buildx
|
||||||
|
ARG TARGETARCH
|
||||||
|
ARG VERSION
|
||||||
|
ARG ARCH
|
||||||
|
|
||||||
|
# if we had no TARGETARCH (not buildx), use --build-arg ARCH. default to amd64
|
||||||
|
RUN echo "amd64" > /etc/docker_arch
|
||||||
|
RUN if [ ! -z "$ARCH" ] ; then echo "$ARCH" > /etc/docker_arch ; fi
|
||||||
|
RUN if [ ! -z "$TARGETARCH" ] ; then echo "$TARGETARCH" > /etc/docker_arch ; fi
|
||||||
|
|
||||||
|
# decide which kiwix arch to download later (`armhf` for all arm* and x86_64 otherwise)
|
||||||
|
RUN if [ $(cut -c 1-3 /etc/docker_arch) = "arm" ] ; then echo "armhf" > /etc/kiwix_arch ; else echo "x86_64" > /etc/kiwix_arch ; fi
|
||||||
|
|
||||||
|
# Install kiwix-tools
|
||||||
|
RUN url="http://mirror.download.kiwix.org/release/kiwix-tools/kiwix-tools_linux-$(cat /etc/kiwix_arch)-$VERSION.tar.gz" && \
|
||||||
|
echo "URL: $url" && \
|
||||||
|
wget -O - $url | tar -xz && \
|
||||||
|
mv kiwix-tools*/kiwix-* /usr/local/bin && \
|
||||||
|
rm -r kiwix-tools*
|
||||||
|
|
||||||
|
# expose kiwix-serve default port
|
||||||
|
EXPOSE 80
|
||||||
|
|
||||||
|
CMD ["/bin/sh", "-c", "echo 'Welcome to kiwix-tools! The following binaries are available:' && ls /usr/local/bin/"]
|
||||||
@ -0,0 +1,32 @@
|
|||||||
|
Kiwix-tools Docker image
|
||||||
|
===
|
||||||
|
|
||||||
|
- Available on [docker.io](https://hub.docker.com/r/kiwix/kiwix-tools) and [ghcr.io](https://ghcr.io/kiwix/kiwix-tools).
|
||||||
|
- multi-arch (`linux/amd64`, `linux/arm64`, `linux/arm/v7`)
|
||||||
|
- based on official `kiwix-tools` binaries.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
``` sh
|
||||||
|
$ docker run -it kiwix/kiwix-tools:3.1.2
|
||||||
|
|
||||||
|
Welcome to kiwix-tools! The following binaries are available:
|
||||||
|
kiwix-manage kiwix-read kiwix-search kiwix-serve
|
||||||
|
```
|
||||||
|
|
||||||
|
`kiwix-tools` operates on zim files. You shall mount a volume to access the files.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
docker run -v $(pwd):/data -it kiwix/kiwix-tools kiwix-read --suggest="Mali" /data/wikipedia_fr_test.zim
|
||||||
|
```
|
||||||
|
|
||||||
|
## Building and reusing
|
||||||
|
|
||||||
|
- `kiwix/kiwix-tools` is multi-arch and is ideally built using `buildx`.
|
||||||
|
- requires a `--build-arg VERSION=` with the kiwix-tools release.
|
||||||
|
- can be built using `docker build` in which case it expects an additionnal `--build-arg ARCH=arm` for arm. Otherwise defaults to `amd64`.
|
||||||
|
|
||||||
|
**Notes:**
|
||||||
|
|
||||||
|
- `wget` in `alpine:3` on `arm/v7` (__inside github action only__) crashes when downloading from HTTPs locations. Keep http-only in Dockerfile.
|
||||||
|
- Was also unhappy when using the mirrors so it's using `mirror.download` on purpose.
|
||||||
Loading…
Reference in new issue