Skip to content

Commit

Permalink
Merge pull request #60 from bertsky/patch-4
Browse files Browse the repository at this point in the history
improve-docker-build
  • Loading branch information
bertsky authored Oct 1, 2024
2 parents a3f25d7 + 894fa62 commit 4798001
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
14 changes: 9 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM ocrd/core

ARG DOCKER_BASE_IMAGE
FROM $DOCKER_BASE_IMAGE
ARG VCS_REF
ARG BUILD_DATE
LABEL \
Expand All @@ -13,15 +13,19 @@ ENV PREFIX=/usr/local

RUN apt-get update && apt-get install -y openjdk-11-jdk-headless wget git gcc unzip

WORKDIR /build
WORKDIR /build/ocrd_fileformat

COPY .git .git/
COPY repo/ocr-fileformat repo/ocr-fileformat/
COPY ocrd-fileformat-transform .
COPY ocrd-tool.json .
COPY Makefile .
RUN make install-fileformat install PREFIX=/usr/local SHELL="bash -x"

RUN make install-fileformat install PREFIX=$PREFIX SHELL="bash -x" && \
rm -fr /build/ocrd_fileformat
# smoke test
RUN ocrd-fileformat-transform --version

WORKDIR /data
ENV DEBIAN_FRONTEND teletype
CMD ["/usr/local/bin/ocrd-fileformat-transform", "--help"]

9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
PROJECT_NAME := ocrd_fileformat
TOOLS = ocrd-fileformat-transform
DOCKER_TAG = ocrd/fileformat
DOCKER_BASE_IMAGE ?= docker.io/ocrd/core:v2.69.0
DOCKER_TAG ?= ocrd/fileformat

PIP ?= pip3

Expand Down Expand Up @@ -67,7 +68,11 @@ uninstall:

# Build Docker image
docker:
docker build -t '$(DOCKER_TAG)' .
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) .

#
# Assets
Expand Down

0 comments on commit 4798001

Please sign in to comment.