Sign inSign up

nextstage/tika-service

By nextstage

Updated 26 days ago

Image
0

532

nextstage/tika-service repository overview

tika-service

Apache Tika Server image with Portuguese OCR (Tesseract por + eng), ImageMagick preprocessing, and a fixed tika-config.xml.

Built on top of [apache/tika](https://hub.docker.com/r/apache/tika) (*-full variant).

Image

TagDescription
nextstage/tika-service:3.3Tika 3.3.0.0-full
docker pull nextstage/tika-service:3.3

Run

docker run --rm -d \
  --name tika \
  -p 9998:9998 \
  nextstage/tika-service:3.3

Health check:

curl -s http://localhost:9998/tika
# Apache Tika Server ...
docker-compose
services:
  tika:
    image: nextstage/tika-service:3.3
    ports:
      - "9998:9998"
    restart: unless-stopped

API examples

Default port: 9998.

Detect MIME type
curl -X PUT --data-binary @document.pdf \
  http://localhost:9998/detect/stream
Extract plain text
curl -X PUT --data-binary @document.pdf \
  -H "Accept: text/plain" \
  http://localhost:9998/tika
Extract HTML
curl -X PUT --data-binary @document.pdf \
  -H "Accept: text/html" \
  http://localhost:9998/tika
Metadata only
curl -X PUT --data-binary @document.pdf \
  -H "Accept: application/json" \
  http://localhost:9998/meta
Recursive metadata (container + embedded docs)
curl -X PUT --data-binary @archive.zip \
  -H "Accept: application/json" \
  http://localhost:9998/rmeta
OCR on image / scanned PDF

OCR is enabled for Portuguese and English (por+eng). Preprocessing uses ImageMagick (density 300, timeout 180s).

curl -X PUT --data-binary @scan.png \
  -H "Accept: text/plain" \
  -H "X-Tika-OCRLanguage: por+eng" \
  http://localhost:9998/tika
curl -X PUT --data-binary @scanned.pdf \
  -H "Accept: text/plain" \
  http://localhost:9998/tika
From PHP
$ch = curl_init('http://tika:9998/tika');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'PUT',
    CURLOPT_POSTFIELDS    => file_get_contents('/path/to/file.pdf'),
    CURLOPT_HTTPHEADER    => ['Accept: text/plain'],
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_TIMEOUT       => 180,
]);
$text = curl_exec($ch);
curl_close($ch);

Config

[tika-config.xml](./tika-config.xml) is baked into the image at /tika-config.xml:

  • DefaultParser excludes the built-in OCR parser instance
  • Dedicated TesseractOCRParser with:
    • language: por+eng
    • pageSegMode: 4
    • density: 300
    • enableImagePreprocessing: true
    • timeoutSeconds: 180
    • minFileSizeToOcr: 0

License

This image layers config and packages on Apache Tika. Tika is licensed under the Apache License 2.0.

Tag summary

Content type

Image

Digest

sha256:053150cf6

Size

333.7 MB

Last updated

26 days ago

docker pull nextstage/tika-service