|
|
|
@ -2,8 +2,10 @@ FROM ubuntu:18.04
|
|
|
|
|
|
|
|
|
|
ENV LC_ALL=C.UTF-8 LANG=C.UTF-8
|
|
|
|
|
|
|
|
|
|
RUN mkdir /var/lib/calamari-models
|
|
|
|
|
COPY data/calamari-models/GT4HistOCR /var/lib/calamari-models/GT4HistOCR
|
|
|
|
|
ENV LEPTONICA_VERSION 1.78.0
|
|
|
|
|
ENV TESSERACT_VERSION 4.1.0
|
|
|
|
|
ENV TESSDATA_BEST_VERSION 4.0.0
|
|
|
|
|
ENV TESSDATA_PREFIX /usr/local/share/tessdata
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RUN apt-get update && \
|
|
|
|
@ -24,12 +26,6 @@ RUN apt-get update && \
|
|
|
|
|
|
|
|
|
|
# Build Leptonica and Tesseract.
|
|
|
|
|
# XXX Use a multi stage build for this.
|
|
|
|
|
ENV LEPTONICA_VERSION 1.78.0
|
|
|
|
|
ENV TESSERACT_VERSION 4.1.0
|
|
|
|
|
ENV TESSDATA_BEST_VERSION 4.0.0
|
|
|
|
|
|
|
|
|
|
ENV TESSDATA_PREFIX /usr/local/share/tessdata
|
|
|
|
|
|
|
|
|
|
RUN curl -sSL -O https://github.com/DanBloomberg/leptonica/releases/download/$LEPTONICA_VERSION/leptonica-$LEPTONICA_VERSION.tar.gz && \
|
|
|
|
|
tar xvzf leptonica-$LEPTONICA_VERSION.tar.gz && \
|
|
|
|
|
cd leptonica-$LEPTONICA_VERSION && \
|
|
|
|
@ -45,9 +41,16 @@ RUN curl -sSL -O https://github.com/tesseract-ocr/tesseract/archive/$TESSERACT_V
|
|
|
|
|
RUN curl -sSL -O https://github.com/tesseract-ocr/tessdata_best/archive/$TESSDATA_BEST_VERSION.tar.gz && \
|
|
|
|
|
tar xvzf $TESSDATA_BEST_VERSION.tar.gz && \
|
|
|
|
|
mv tessdata_best-$TESSDATA_BEST_VERSION $TESSDATA_PREFIX && \
|
|
|
|
|
rm -rf $TESSDATA_BEST_VERSION.tar.gz && \
|
|
|
|
|
tesseract --list-langs
|
|
|
|
|
rm -rf $TESSDATA_BEST_VERSION.tar.gz
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Copy OCR models
|
|
|
|
|
RUN mkdir /var/lib/calamari-models
|
|
|
|
|
COPY data/calamari-models/GT4HistOCR /var/lib/calamari-models/GT4HistOCR
|
|
|
|
|
RUN mkdir $TESSDATA_PREFIX
|
|
|
|
|
COPY data/tesseract-models/GT4HistOCR/GT4HistOCR_2000000.traineddata $TESSDATA_PREFIX
|
|
|
|
|
|
|
|
|
|
RUN tesseract --list-langs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
COPY requirements.txt /tmp
|
|
|
|
|