You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ocrd-galley/run

43 lines
1.4 KiB
Bash

#!/bin/bash
set -e # Abort on error
self=`realpath $0`
self_dir=`dirname "$self"`
# Docker run options
docker_run_options="--rm -t"
docker_run_options="$docker_run_options --mount type=bind,src=\"$(pwd)\",target=/data"
# In podman, the container always runs as the real user == uid 0 in container
if docker -v 2>&1 | grep -q podman; then
user="0:0"
else
user="`id -u`:`id -g`"
fi
docker_run_options="$docker_run_options --user $user"
docker_run_options="$docker_run_options -e LOG_LEVEL=$LOG_LEVEL"
# The containers currently need to run privileged to allow it to read from e.g.
# /home on SELinux secured systems such as Fedora. We might want to use udica
# instead in the future.
docker_run_options="$docker_run_options --privileged=true"
# Build aliases for the containerized ocrd processors
build_alias() {
local command=$1
local docker_image=$2
alias $command="docker run $docker_run_options $docker_image $command"
}
shopt -s expand_aliases # Required for non-interactive shells
build_alias ocrd boxed-base
build_alias ocrd-olena-binarize boxed-ocrd_olena
build_alias ocrd-sbb-textline-detector boxed-sbb_textline_detector
build_alias ocrd-calamari-recognize boxed-ocrd_calamari
build_alias ocrd-tesserocr-recognize boxed-ocrd_tesserocr
build_alias ocrd-dinglehopper boxed-dinglehopper
. $self_dir/my_ocrd_workflow