Skip to content

Commit 4309d91

Browse files
authored
Merge pull request #46 from bertsky/docker-res
Docker: resmgr shortcut
2 parents 3553a01 + 3b8d850 commit 4309d91

File tree

5 files changed

+106
-48
lines changed

5 files changed

+106
-48
lines changed

Dockerfile

+7-7
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,18 @@ ENV PIP pip3
2626
# so let XDG_DATA_HOME coincide with fixed system location
2727
# (can still be overridden by derived stages)
2828
ENV XDG_DATA_HOME /usr/local/share
29+
# avoid the need for an extra volume for persistent resource user db
30+
# (i.e. XDG_CONFIG_HOME/ocrd/resources.yml)
31+
ENV XDG_CONFIG_HOME /usr/local/share/ocrd-resources
2932

3033
WORKDIR /build-ocrd
31-
COPY setup.py .
32-
COPY ocrd_kraken ./ocrd_kraken
33-
COPY ocrd_kraken/ocrd-tool.json .
34-
COPY README.md .
35-
COPY requirements.txt .
36-
COPY Makefile .
34+
COPY . .
35+
# prepackage ocrd-tool.json as ocrd-all-tool.json
36+
RUN ocrd ocrd-tool ocrd_kraken/ocrd-tool.json dump-tools > $(dirname $(ocrd bashlib filename))/ocrd-all-tool.json
37+
# install everything and reduce image size
3738
RUN make deps-ubuntu \
3839
&& make deps install \
3940
&& rm -fr /build-ocrd
4041

4142
WORKDIR /data
4243
VOLUME /data
43-

Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ PYTHONIOENCODING=utf8
88

99
# Docker container tag ("$(DOCKER_TAG)")
1010
DOCKER_TAG = 'ocrd/kraken'
11-
DOCKER_BASE_IMAGE = docker.io/ocrd/core-cuda-torch:v2.70.0
11+
DOCKER_BASE_IMAGE = docker.io/ocrd/core-cuda-torch:v3.1.0
1212

1313

1414
# BEGIN-EVAL makefile-parser --make-help Makefile
@@ -92,4 +92,4 @@ tests/assets: repo/assets
9292
mkdir -p tests/assets
9393
cp -a repo/assets/data/* tests/assets
9494

95-
.PHONY: docker install install-dev deps deps-ubuntu deps-test test help
95+
.PHONY: docker install install-dev build deps deps-ubuntu deps-test test help

ocrd_kraken/ocrd-tool.json

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"git_url": "https://github.com/OCR-D/ocrd_kraken",
33
"version": "1.0.1",
4+
"dockerhub": "ocrd/kraken",
45
"tools": {
56
"ocrd-kraken-binarize": {
67
"executable": "ocrd-kraken-binarize",

pyproject.toml

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
[build-system]
2+
requires = ["setuptools>=61.0.0", "wheel", "setuptools-ocrd"]
3+
4+
[project]
5+
name = "ocrd_kraken"
6+
authors = [
7+
{name = "Robert Sachunsky", email = "sachunsky@informatik.uni-leipzig.de"},
8+
{name = "Konstantin Baierer", email = "unixprog@gmail.com"},
9+
]
10+
description = "Recognize text using Kraken OCR and the OCR-D framework"
11+
readme = "README.md"
12+
license = {text = "Apache License 2.0"}
13+
requires-python = ">=3.8"
14+
keywords = ["ocr", "ocr-d", "kraken-ocr"]
15+
16+
dynamic = ["version", "dependencies", "optional-dependencies"]
17+
18+
# https://pypi.org/classifiers/
19+
classifiers = [
20+
"Development Status :: 5 - Production/Stable",
21+
"Environment :: Console",
22+
"Intended Audience :: Science/Research",
23+
"Intended Audience :: Other Audience",
24+
"License :: OSI Approved :: Apache Software License",
25+
"Programming Language :: Python :: 3",
26+
"Programming Language :: Python :: 3 :: Only",
27+
"Topic :: Text Processing",
28+
]
29+
30+
[project.scripts]
31+
ocrd-kraken-recognize = "ocrd_kraken.cli.recognize:cli"
32+
ocrd-kraken-segment = "ocrd_kraken.cli.segment:cli"
33+
ocrd-kraken-binarize = "ocrd_kraken.cli.binarize:cli"
34+
35+
[project.urls]
36+
Homepage = "https://github.com/OCR-D/ocrd_kraken"
37+
Repository = "https://github.com/OCR-D/ocrd_kraken.git"
38+
39+
40+
[tool.setuptools.dynamic]
41+
dependencies = {file = ["requirements.txt"]}
42+
#optional-dependencies.dev = {file = ["requirements_dev.txt"]}
43+
optional-dependencies.test = {file = ["requirements_test.txt"]}
44+
45+
[tool.setuptools]
46+
packages = ["ocrd_kraken", "ocrd_kraken.cli"]
47+
package-data = {"*" = ["ocrd-tool.json"]}
48+
49+
[tool.pytest.ini_options]
50+
minversion = 6.0
51+
addopts = "--strict-markers"
52+
markers = [
53+
"integration: integration tests",
54+
]
55+
56+
57+
[tool.mypy]
58+
plugins = ["numpy.typing.mypy_plugin"]
59+
60+
ignore_missing_imports = true
61+
62+
63+
strict = true
64+
65+
disallow_subclassing_any = false
66+
# ❗ error: Class cannot subclass "Processor" (has type "Any")
67+
disallow_any_generics = false
68+
disallow_untyped_defs = false
69+
disallow_untyped_calls = false
70+
71+
72+
[tool.ruff.lint]
73+
select = ["E", "F", "I"]
74+
75+
76+
[tool.coverage.run]
77+
branch = true
78+
source = [
79+
"ocrd_kraken"
80+
]
81+
concurrency = [
82+
"thread",
83+
"multiprocessing"
84+
]
85+
86+
[tool.coverage.report]
87+
exclude_also = [
88+
"if self\\.debug",
89+
"pragma: no cover",
90+
"raise NotImplementedError",
91+
"if __name__ == .__main__.:",
92+
]
93+
ignore_errors = true
94+
omit = [
95+
"ocrd_kraken/cli"
96+
]

setup.py

-39
This file was deleted.

0 commit comments

Comments
 (0)