From 478edc804a0de01a1966a0df24468344e7a26cf0 Mon Sep 17 00:00:00 2001 From: kba Date: Mon, 16 Sep 2024 18:21:14 +0200 Subject: [PATCH 1/5] Add Dockerfile and make docker target --- Dockerfile | 26 ++++++++++++++++++++++++++ Makefile | 14 ++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..6c76564 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,26 @@ +ARG DOCKER_BASE_IMAGE +FROM $DOCKER_BASE_IMAGE + +ARG VCS_REF +ARG BUILD_DATE +LABEL \ + maintainer="https://ocr-d.de/kontakt" \ + org.label-schema.vcs-ref=$VCS_REF \ + org.label-schema.vcs-url="https://github.com/qurator-spk/eynollah" \ + org.label-schema.build-date=$BUILD_DATE + +ENV DEBIAN_FRONTEND=noninteractive +ENV PYTHONIOENCODING=utf8 +ENV XDG_DATA_HOME=/usr/local/share + +WORKDIR /build-eynollah +COPY qurator/ ./qurator +COPY pyproject.toml . +COPY requirements.txt . +COPY README.md . +COPY Makefile . +RUN apt-get install -y --no-install-recommends g++ +RUN make install + +WORKDIR /data +VOLUME /data diff --git a/Makefile b/Makefile index 4b43564..a3bde05 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,11 @@ EYNOLLAH_MODELS ?= $(PWD)/models_eynollah export EYNOLLAH_MODELS +# DOCKER_BASE_IMAGE = artefakt.dev.sbb.berlin:5000/sbb/ocrd_core:v2.68.0 +DOCKER_BASE_IMAGE = docker.io/ocrd/core:v2.68.0 +DOCKER_TAG = ocrd/eynollah + + # BEGIN-EVAL makefile-parser --make-help Makefile help: @@ -48,3 +53,12 @@ smoke-test: # Run unit tests test: pytest tests + +# Build docker image +docker: + docker build \ + --build-arg DOCKER_BASE_IMAGE=$(DOCKER_BASE_IMAGE) \ + --build-arg VCS_REF=$$(git rev-parse --short HEAD) \ + --build-arg BUILD_DATE=$$(date -u +"%Y-%m-%dT%H:%M:%SZ") \ + -t $(DOCKER_TAG) . + From c487be2a1dfcb444f1896dd725183b6dfc8fb96f Mon Sep 17 00:00:00 2001 From: kba Date: Tue, 1 Oct 2024 15:38:01 +0200 Subject: [PATCH 2/5] dockerfile: use src-layout --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 6c76564..6780bc2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,7 +14,7 @@ ENV PYTHONIOENCODING=utf8 ENV XDG_DATA_HOME=/usr/local/share WORKDIR /build-eynollah -COPY qurator/ ./qurator +COPY src/ ./src COPY pyproject.toml . COPY requirements.txt . COPY README.md . From b13759fdcf50db60966ec98050fa95bddb54728a Mon Sep 17 00:00:00 2001 From: kba Date: Tue, 1 Oct 2024 15:38:39 +0200 Subject: [PATCH 3/5] ci: smoke-test make docker --- .github/workflows/test-eynollah.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test-eynollah.yml b/.github/workflows/test-eynollah.yml index 98ddc06..3a33dcf 100644 --- a/.github/workflows/test-eynollah.yml +++ b/.github/workflows/test-eynollah.yml @@ -34,3 +34,5 @@ jobs: pip install -r requirements-test.txt - name: Test with pytest run: make test + - name: Test docker build + run: make docker From 21893910b87c6546bbd68e8b4dd720791a24589c Mon Sep 17 00:00:00 2001 From: Clemens Neudecker <952378+cneud@users.noreply.github.com> Date: Wed, 16 Oct 2024 14:20:53 +0200 Subject: [PATCH 4/5] relax tf2 requirement to < 2.13 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index f01d319..e6f6e4b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,7 +2,7 @@ ocrd >= 2.23.3 numpy <1.24.0 scikit-learn >= 0.23.2 -tensorflow == 2.12.1 +tensorflow < 2.13 imutils >= 0.5.3 matplotlib setuptools >= 50 From bc9dddd2c09190f975b5b7fce8d2f5e74aaf2f97 Mon Sep 17 00:00:00 2001 From: Clemens Neudecker <952378+cneud@users.noreply.github.com> Date: Wed, 16 Oct 2024 14:21:48 +0200 Subject: [PATCH 5/5] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 292cfbc..916c556 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ :warning: Development is currently focused on achieving the best possible quality of results for a wide variety of historical documents and therefore processing can be very slow. We aim to improve this, but contributions are welcome. ## Installation -Python `3.8-3.11` with Tensorflow `2.12-2.15` on Linux are currently supported. +Python `3.8-3.11` with Tensorflow `<2.13` on Linux are currently supported. For (limited) GPU support the CUDA toolkit needs to be installed.