Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix dockerfile #119

Merged
merged 2 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 24 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,35 @@
FROM ocrd/core
MAINTAINER OCR-D
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/OCR-D/ocrd_calamari" \
org.label-schema.build-date=$BUILD_DATE \
org.opencontainers.image.vendor="DFG-Funded Initiative for Optical Character Recognition Development" \
org.opencontainers.image.title="ocrd_calamari" \
org.opencontainers.image.description="OCR-D compliant workspace processor for the functionality of Calamari OCR" \
org.opencontainers.image.source="https://github.com/OCR-D/ocrd_calamari" \
org.opencontainers.image.documentation="https://github.com/OCR-D/ocrd_calamari/blob/${VCS_REF}/README.md" \
org.opencontainers.image.revision=$VCS_REF \
org.opencontainers.image.created=$BUILD_DATE \
org.opencontainers.image.base.name=$DOCKER_BASE_IMAGE
ENV DEBIAN_FRONTEND noninteractive
ENV PYTHONIOENCODING utf8
ENV LC_ALL C.UTF-8
ENV LANG C.UTF-8

WORKDIR /build
WORKDIR /build/calamari
kba marked this conversation as resolved.
Show resolved Hide resolved
COPY Makefile .
COPY setup.py .
COPY pyproject.toml .
kba marked this conversation as resolved.
Show resolved Hide resolved
COPY ocrd-tool.json .
COPY requirements.txt .
COPY README.md .
COPY ocrd_calamari ocrd_calamari
COPY ocrd_calamari ./ocrd_calamari
RUN make install
kba marked this conversation as resolved.
Show resolved Hide resolved
RUN rm -rf /build/calamari

RUN pip3 install --upgrade pip && \
pip3 install . && \
pip3 check

ENTRYPOINT ["/usr/local/bin/ocrd-calamari-recognize"]
WORKDIR /data
VOLUME ["/data"]
23 changes: 18 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ EXAMPLE = actevedef_718448162.first-page+binarization+segmentation

# BEGIN-EVAL makefile-parser --make-help Makefile

DOCKER_BASE_IMAGE = docker.io/ocrd/core-cuda-tf2:v2.70.0
DOCKER_TAG = 'ocrd/calamari'

help:
@echo ""
@echo " Targets"
Expand All @@ -21,13 +24,16 @@ help:
@echo " assets-clean Remove symlinks in test/assets"
@echo " test Run unit tests"
@echo " coverage Run unit tests and determine test coverage"
@echo " docker Build Docker image"
@echo ""
@echo " Variables"
@echo ""
@echo " PYTHON '$(PYTHON)'"
@echo " PIP_INSTALL '$(PIP_INSTALL)'"
@echo " GIT_CLONE '$(GIT_CLONE)'"
@echo " MODEL '$(MODEL)'"
@echo " PYTHON '$(PYTHON)'"
@echo " PIP_INSTALL '$(PIP_INSTALL)'"
@echo " GIT_CLONE '$(GIT_CLONE)'"
@echo " MODEL '$(MODEL)'"
@echo " DOCKER_TAG '$(DOCKER_TAG)'"
@echo " DOCKER_BASE_IMAGE '$(DOCKER_BASE_IMAGE)'"

# END-EVAL

Expand Down Expand Up @@ -91,4 +97,11 @@ coverage: test/assets $(MODEL)
coverage report
coverage html

.PHONY: install assets-clean deps-test test coverage $(MODEL) example
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) .

.PHONY: install assets-clean deps-test test coverage $(MODEL) example docker
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ Repository = "https://github.com/OCR-D/ocrd_calamari.git"
dependencies = {file = ["requirements.txt"]}
optional-dependencies.dev = {file = ["requirements-dev.txt"]}

[tool.setuptools.package-data]
"*" = ["*.json"]

[tool.setuptools.packages.find]
where = ["."]
include = ["ocrd_calamari"]
Expand Down