-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
128 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# SPDX-FileCopyrightText: 2023 James R. Barlow | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
FROM arm64v8/alpine:3.19.1 as base | ||
|
||
ENV LANG=C.UTF-8 | ||
ENV TZ=UTC | ||
|
||
RUN apk add --no-cache \ | ||
python3 \ | ||
zlib | ||
|
||
FROM base as builder | ||
|
||
RUN apk add --no-cache \ | ||
ca-certificates \ | ||
git \ | ||
python3-dev \ | ||
py3-pip | ||
|
||
# On arm64, we need to build cffi from source. | ||
RUN apk add --no-cache \ | ||
build-base \ | ||
autoconf \ | ||
automake \ | ||
libtool \ | ||
zlib-dev \ | ||
libffi-dev \ | ||
cairo-dev \ | ||
pkgconfig \ | ||
; \ | ||
fi | ||
|
||
COPY . /app | ||
|
||
WORKDIR /app | ||
|
||
RUN python3 -m venv .venv | ||
|
||
RUN source .venv/bin/activate \ | ||
&& python3 -m pip install --no-cache-dir --upgrade pip \ | ||
&& python3 -m pip install --no-cache-dir wheel \ | ||
&& python3 -m pip install --no-cache-dir .[test,webservice,watcher] | ||
|
||
FROM base | ||
|
||
RUN apk add --no-cache \ | ||
ghostscript \ | ||
jbig2dec \ | ||
jbig2enc \ | ||
pngquant \ | ||
tesseract-ocr \ | ||
tesseract-ocr-data-chi_sim \ | ||
tesseract-ocr-data-deu \ | ||
tesseract-ocr-data-eng \ | ||
tesseract-ocr-data-fra \ | ||
tesseract-ocr-data-osd \ | ||
tesseract-ocr-data-por \ | ||
tesseract-ocr-data-spa \ | ||
ttf-droid \ | ||
unpaper \ | ||
&& rm -rf /var/cache/apk/* | ||
|
||
WORKDIR /app | ||
|
||
COPY --from=builder /usr/local/lib/ /usr/local/lib/ | ||
COPY --from=builder /usr/local/bin/ /usr/local/bin/ | ||
|
||
COPY --from=builder /app/.venv/ /app/.venv/ | ||
|
||
COPY --from=builder /app/misc/webservice.py /app/ | ||
COPY --from=builder /app/misc/watcher.py /app/ | ||
|
||
# Copy minimal project files to get the test suite. | ||
COPY --from=builder /app/pyproject.toml /app/README.md /app/ | ||
COPY --from=builder /app/tests /app/tests | ||
|
||
ENV PATH="/app/.venv/bin:${PATH}" | ||
|
||
ENTRYPOINT ["/app/.venv/bin/ocrmypdf"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters