This section provides instructions for running ABBYY FineReader Engine 12 inside a Docker container. This scenario uses two containers:
one container with ABBYY FineReader Engine
one container with the Licensing Service
Implementing of this scenario increases the fault tolerance and ensures the continuous operation of all containers. If one of the containers fails, you can restart it without interrupting the other.An Online License, which connects to *.abbyy.com license server, is used for this scenario.
ABBYY Licensing Service can work with only one Online License at the same time.
You need:
an Online License token file
the password to the license token file
You need to fulfill the following conditions for using an Online License wherever ABBYY Licensing Service is installed:
Active Internet connection
Allowed connections to *.abbyy.com on port 443 (HTTPS)
GoDaddy Trusted Root Certification Authority contained in ca-certificates package (see details on the GoDaddy website)
To run ABBYY FineReader Engine 12 in Docker container:
Dockerfile_ls — a Dockerfile for container with the Licensing Service (see its listing below)
Dockerfile_ls is intended for building a container that will be working with only one container built from Dockerfile_worker . Do not configure multiple replicas of container with ABBYY FineReader Engine to work with a single Licensing Service.
Note: This container runs the Licensing Service with /standalone key. With this key, the Licensing Service works as a foreground process, which is the best practice for working in Docker containers.
Dockerfile_worker — a Dockerfile for container with ABBYY FineReader Engine (see its listing below)
wrapper.sh — a command-line script for running the sample and displaying its results in the console (see its listing below)
docker-compose.yml — a configuration of Docker Compose (see its listing below)
Note that for container with ABBYY FineReader Engine, we set the /dev/shm size manually in docker-compose.yml . We recommend setting it to at least 1GB.
# Stage 1.# From this part we take the Licensing ServiceFROM ubuntu:bionic as builder# Install the required packagesRUN DEBIAN_FRONTEND=noninteractive \ apt update \ && apt install --no-install-recommends --yes \ bash \ gzip \ tar \ coreutils \ gettext-baseCOPY FRE*.sh /tmp/FRE12.sh# Install ABBYY FineReader EngineRUN chmod +x /tmp/FRE12.sh && /tmp/FRE12.sh -- \ --install-dir "/opt/ABBYY/FREngine12" \ --skip-local-license-activation# Stage 2. Take a clean image# Prepare it for using the Licensing ServiceFROM ubuntu:bionic# Install the required packagesRUN DEBIAN_FRONTEND=noninteractive \ apt update \ && apt install --no-install-recommends --yes \ ca-certificates \ bash \ libc6 \ libgcc-8-dev \ libstdc++-8-dev# Copy the Licensing Service from stage 1COPY --from=builder /usr/local/bin/ABBYY/SDK/12/Licensing /usr/local/bin/ABBYY/SDK/12/Licensing/COPY --from=builder /usr/local/lib/ABBYY/SDK/12/Licensing /usr/local/lib/ABBYY/SDK/12/Licensing/# Create a folder for working of the Licensing Service RUN mkdir /var/lib/ABBYY/SDK/12/Licenses -p && chmod 755 /var/lib/ABBYY/SDK/12/LicensesENV LD_LIBRARY_PATH=/usr/local/lib/ABBYY/SDK/12/LicensingEXPOSE 3023ENTRYPOINT ["/usr/local/bin/ABBYY/SDK/12/Licensing/LicensingService", "/standalone"]
Dockerfile_worker
Dockerfile_worker
# Stage 1. # From this part we take a directory with ABBYY FineReader Engine installed and the compiled sample# Use the official GCC container to get all development tools. # We use 8th version of GCC as an example only because it is the default GCC in ubuntu bionic# you can use any version starting from 4.8FROM gcc:8 as builderARG license_tokenARG license_passwordARG service_address# Copy the license token file and use it to generate the correct SamplesConfig.h # during the installation processCOPY ${license_token} /tmp/${license_token}COPY FRE*.sh /tmp/FRE12.sh# Install ABBYY FineReader Engine 12 and build the sampleRUN chmod +x /tmp/FRE12.sh && /tmp/FRE12.sh -- \ --install-dir "/opt/ABBYY/FREngine12" \ --license-path "/tmp/${license_token}" \ --license-password "${license_password}" \ --service-address "${service_address}" \ --developer-installWORKDIR /opt/ABBYY/FREngine12/Samples/CommandLineInterfaceRUN make# To copy entire folders at the next stage, remove all unnecessary files from# distribution kit of installed ABBYY FineReader EngineRUN rm /opt/ABBYY/FREngine12/Bin/libProtection.Developer.so# Stage 2. Take a clean image # Prepare it for using ABBYY FineReader Engine# At this stage we use a minimalistic ubuntu image without development toolsFROM ubuntu:bionic# Install the required packages RUN DEBIAN_FRONTEND=noninteractive \ apt update \ && apt install --no-install-recommends --yes \ ca-certificates \ bash \ libc6 \ libglib2.0-0 \ libgcc-8-dev \ libstdc++-8-dev \ zlib1g \ libx11-6 \ libfreetype6 \ libxext-dev \ libice-dev \ libsm-dev \ locales \ && locale-gen en_US.UTF-8# Copy ABBYY FineReader Engine from stage 1COPY --from=builder /opt/ABBYY/FREngine12/Bin /opt/ABBYY/FREngine12/BinCOPY --from=builder /opt/ABBYY/FREngine12/Data /opt/ABBYY/FREngine12/Data# Create a folder for working of the Licensing Service and cache storage# Copy the license token file into this folderCOPY --from=builder /var/lib/ABBYY/SDK/12/Licenses/*.ABBYY.ActivationToken /var/lib/ABBYY/SDK/12/Licenses/# Copy the compiled sample and demo imageCOPY --from=builder /opt/ABBYY/FREngine12/Samples/CommandLineInterface/CommandLineInterface /app/COPY --from=builder /opt/ABBYY/FREngine12/Samples/SampleImages/Demo.tif /app/ENV LD_LIBRARY_PATH=/opt/ABBYY/FREngine12/Bin# wrapper.sh - a script for launching the sample and displaying the result in the consoleCOPY ./wrapper.sh /wrapper.shRUN chmod +x /wrapper.shENTRYPOINT ["/wrapper.sh"]
wrapper.sh
#!/bin/bash# Launch sample/app/CommandLineInterface $1status=$?if [ $status -ne 0 ]; then echo "Failed to launch app: $status" exit $statusficat ${1##*-of}echo "Done"