Skip to content

Commit

Permalink
Add isle-leptonica to stack (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
joecorall authored Nov 15, 2024
1 parent 8d21bae commit 14b2276
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 21 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ RUN adduser -S -G nobody scyllaridae

RUN apk update && \
apk add --no-cache \
curl==8.10.1-r0 \
curl==8.11.0-r2 \
bash==5.2.26-r0 \
ca-certificates==20240705-r0 \
openssl==3.3.2-r1
Expand Down
8 changes: 8 additions & 0 deletions examples/imagemagick/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# imagemagick

imagemagick as a service

## Attribution

- [imagemagick](https://github.com/ImageMagick/ImageMagick) for image file manipulation
- [islandora/imagemagick](https://github.com/Islandora-Devops/isle-imagemagick/) for a custom Alpine APK imagemagick package.
35 changes: 19 additions & 16 deletions examples/mergepdf/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
ARG TAG=main
ARG DOCKER_REPOSITORY=local
FROM islandora/leptonica:alpine-3.20.2-leptonica-1.84.1-r0 AS leptonica
FROM ${DOCKER_REPOSITORY}/scyllaridae-imagemagick:${TAG} AS scyllaridae

RUN apk update && \
apk add --no-cache \
ghostscript==10.04.0-r0 \
jq==1.7.1-r0 \
leptonica-dev==1.84.1-r0 \
tesseract-ocr==5.3.4-r0 \
tesseract-ocr-data-eng==5.3.4-r0 \
tesseract-ocr-data-fra==5.3.4-r0 \
tesseract-ocr-data-spa==5.3.4-r0 \
tesseract-ocr-data-ita==5.3.4-r0 \
tesseract-ocr-data-por==5.3.4-r0 \
tesseract-ocr-data-hin==5.3.4-r0 \
tesseract-ocr-data-deu==5.3.4-r0 \
tesseract-ocr-data-jpn==5.3.4-r0 \
tesseract-ocr-data-rus==5.3.4-r0 \
poppler-utils==24.02.0-r1
RUN --mount=type=bind,from=leptonica,source=/packages,target=/packages \
--mount=type=bind,from=leptonica,source=/etc/apk/keys,target=/etc/apk/keys \
apk update && \
apk add --no-cache \
/packages/leptonica-*.apk \
ghostscript==10.04.0-r0 \
jq==1.7.1-r0 \
tesseract-ocr==5.3.4-r0 \
tesseract-ocr-data-eng==5.3.4-r0 \
tesseract-ocr-data-fra==5.3.4-r0 \
tesseract-ocr-data-spa==5.3.4-r0 \
tesseract-ocr-data-ita==5.3.4-r0 \
tesseract-ocr-data-por==5.3.4-r0 \
tesseract-ocr-data-hin==5.3.4-r0 \
tesseract-ocr-data-deu==5.3.4-r0 \
tesseract-ocr-data-jpn==5.3.4-r0 \
tesseract-ocr-data-rus==5.3.4-r0 \
poppler-utils==24.02.0-r1

COPY . /app

Expand Down
7 changes: 7 additions & 0 deletions examples/mergepdf/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# mergepdf

Merge children of a paged content item into a single PDF

## Attribution

- [imagemagick](https://github.com/ImageMagick/ImageMagick) for image file manipulation
- [tesseract](https://github.com/tesseract-ocr/tesseract) OCR engine
- [islandora/imagemagick](https://github.com/Islandora-Devops/isle-imagemagick/) for a custom Alpine APK imagemagick package.
- [islandora/leptonica](https://github.com/Islandora-Devops/isle-leptonica/) for a custom Alpine APK leptonica package.
4 changes: 2 additions & 2 deletions examples/mergepdf/cmd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ set -eou pipefail

TMP_DIR=$(mktemp -d)
I=0
MAX_THREADS=7
MAX_THREADS=${MAX_THREADS:-5}
PIDS=()

# iterate over all images in the IIIF manifest
URLS=$(curl -s "$1/book-manifest" | jq -r '.sequences[0].canvases[].images[0].resource."@id"')
URLS=$(curl -s "$1/book-manifest" | jq -r '.sequences[0].canvases[].images[0].resource."@id"' | awk -F '/' '{print $7}'|sed -e 's/%2F/\//g' -e 's/%3A/:/g')
while read -r URL; do
# If we have reached the max thread limit, wait for any one job to finish
if [ "${#PIDS[@]}" -ge "$MAX_THREADS" ]; then
Expand Down
7 changes: 5 additions & 2 deletions examples/tesseract/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
ARG TAG=main
ARG DOCKER_REPOSITORY=local
FROM islandora/leptonica:alpine-3.20.2-leptonica-1.84.1-r0 AS leptonica
FROM ${DOCKER_REPOSITORY}/scyllaridae:${TAG}

RUN apk update && \
RUN --mount=type=bind,from=leptonica,source=/packages,target=/packages \
--mount=type=bind,from=leptonica,source=/etc/apk/keys,target=/etc/apk/keys \
apk update && \
apk add --no-cache \
leptonica-dev==1.84.1-r0 \
/packages/leptonica-*.apk \
tesseract-ocr==5.3.4-r0 \
tesseract-ocr-data-eng==5.3.4-r0 \
tesseract-ocr-data-fra==5.3.4-r0 \
Expand Down
8 changes: 8 additions & 0 deletions examples/tesseract/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# tesseract

Tesseract as a service

## Attribution

- [tesseract](https://github.com/tesseract-ocr/tesseract) OCR engine
- [islandora/leptonica](https://github.com/Islandora-Devops/isle-leptonica/) for a custom Alpine APK leptonica package.

0 comments on commit 14b2276

Please sign in to comment.