Sign inSign up

dockette/tika

Sponsored OSS

By dockette

•Updated about 5 hours ago

Image
0

581

dockette/tika repository overview

⁠Dockette / Tika

šŸŽ Apache Tika server with OCR on and extra Tesseract languages.

šŸ•¹ f3l1x.io⁠ | šŸ’» f3l1x⁠ | 🐦 @xf3l1x⁠


Apache Tika⁠ server that extracts text and metadata from PDF, Office, images and 1000+ other formats. The upstream apache/tika:<version>-full image has only 7 OCR languages and does not OCR scanned PDFs. This image adds 20 languages and turns OCR on.

⁠Features

  • Apache Tika 3.3.1.0 on the upstream -full image (Tesseract 5, GDAL, ImageMagick)
  • 20 Tesseract languages and osd, see the table below
  • OCR on by default, tuned for scanned PDFs (tika-config.xml⁠)
  • Prometheus JVM metrics on :9464/metrics (jmx_exporter⁠ 1.7.0)
  • Healthcheck on /version
  • Entrypoint, user 35002:35002 and port 9998 are the same as upstream
CodeLanguageCodeLanguage
araArabicjpnJapanese
cesCzechkorKorean
chi_simChinese simplifiednldDutch
chi_traChinese traditionalpolPolish
deuGermanporPortuguese
engEnglishrusRussian
fraFrenchslkSlovak
hinHindispaSpanish
hunHungarianturTurkish
itaItalianukrUkrainian

⁠Usage

docker run --rm -it -p 9998:9998 -p 9464:9464 dockette/tika:latest
# Text
curl -T document.pdf -H 'Accept: text/plain' http://localhost:9998/tika

# OCR in another language (default is eng), or in more languages
curl -T scan.pdf -H 'Accept: text/plain' -H 'X-Tika-OCRLanguage: slk' http://localhost:9998/tika
curl -T scan.pdf -H 'Accept: text/plain' -H 'X-Tika-OCRLanguage: eng+ces' http://localhost:9998/tika

# OCR every page, also when the PDF has a text layer
curl -T doc.pdf -H 'Accept: text/plain' -H 'X-Tika-PDFocrStrategy: ocr_and_text_extraction' http://localhost:9998/tika

# Text and metadata of every embedded document, as JSON
curl -T archive.zip http://localhost:9998/rmeta/text

⁠Configuration

The image runs with tika-config.xml⁠:

  • ocrStrategy=auto: read the text layer, OCR only pages without text
  • ocrDPI=250: measured on scanned invoices; the Tika default 300 gave worse results
  • extractInlineImages=false: true OCRs each page twice and duplicates the text
  • language=eng, pageSegMode=1, timeoutSeconds=300

To use your own file, mount it. Copy the <server> block from ours to keep the metrics.

docker run --rm -it -p 9998:9998 -v $(pwd)/tika-config.xml:/tika-config.xml:ro dockette/tika:latest

Arguments after the image name replace the default --config /tika-config.xml and go to TikaServerCli -h 0.0.0.0.

Set the heap in forkedJvmArgs, for example <arg>-Xmx4g</arg>. Without it, the JVM sizes the heap from host RAM. Do not use JAVA_TOOL_OPTIONS: it applies to both JVMs.

⁠Metrics

Tika parses in a child JVM (TikaServerProcess). The child loads the jmx_exporter agent and serves jvm_* and process_* metrics on port 9464. Tika has no metrics of its own, so there are no per-request metrics. When the child restarts (OOM or timeout), process_start_time_seconds changes.

⁠Versions

VersionRelease
dockette/tika:3.3.1.0-YYYY.MM.DDrelease YYYY.MM.DD
dockette/tika:3.3.1.0latest release
dockette/tika:YYYY.MM.DDrelease YYYY.MM.DD
dockette/tika:latestlatest build of master

All versions build on apache/tika:3.3.1.0-full. Releases are listed on GitHub⁠.

⁠Development

make build          # build the image
make test           # check languages and config
make test-docker    # start the server and OCR a scanned PDF
make run            # run the server on port 19998
make shell          # open a shell in the image
make push           # build and push linux/amd64 and linux/arm64
make version        # print VERSION
make release        # set today's date in VERSION

⁠Maintenance

See how to contribute⁠ to this package. Consider to support⁠ f3l1x. Thank you for using this package.

Tag summary

Content type

Image

Digest

sha256:08ec97c0f…

Size

390.6 MB

Last updated

about 5 hours ago

docker pull dockette/tika

This week's pulls

Pulls:

18

Oct 12 to Oct 18