2023-04-15 22:17:47 +02:00
|
|
|
# Build jbig2enc in a separate stage
|
|
|
|
FROM debian:bullseye-slim as jbig2enc_builder
|
|
|
|
|
|
|
|
RUN apt-get update && \
|
|
|
|
apt-get install -y --no-install-recommends \
|
|
|
|
git \
|
|
|
|
automake \
|
|
|
|
autoconf \
|
|
|
|
libtool \
|
|
|
|
libleptonica-dev \
|
|
|
|
pkg-config \
|
|
|
|
ca-certificates \
|
|
|
|
zlib1g-dev \
|
2023-04-29 00:18:10 +02:00
|
|
|
make \
|
|
|
|
g++
|
2023-04-15 22:17:47 +02:00
|
|
|
|
|
|
|
RUN git clone https://github.com/agl/jbig2enc && \
|
|
|
|
cd jbig2enc && \
|
|
|
|
./autogen.sh && \
|
|
|
|
./configure && \
|
|
|
|
make && \
|
|
|
|
make install
|
|
|
|
|
|
|
|
|
2023-04-29 00:18:10 +02:00
|
|
|
# Main stage
|
|
|
|
FROM openjdk:17-jdk-slim AS base
|
2023-04-15 22:17:47 +02:00
|
|
|
RUN apt-get update && \
|
|
|
|
apt-get install -y --no-install-recommends \
|
|
|
|
libreoffice-core \
|
|
|
|
libreoffice-common \
|
|
|
|
libreoffice-writer \
|
|
|
|
libreoffice-calc \
|
|
|
|
libreoffice-impress \
|
|
|
|
python3-uno \
|
2023-04-26 14:18:24 +02:00
|
|
|
python3-pip \
|
2023-04-15 22:17:47 +02:00
|
|
|
unoconv \
|
2023-04-26 14:18:24 +02:00
|
|
|
pngquant \
|
|
|
|
unpaper \
|
2023-04-15 22:17:47 +02:00
|
|
|
ocrmypdf && \
|
2023-04-29 00:18:10 +02:00
|
|
|
rm -rf /var/lib/apt/lists/* && \
|
|
|
|
mkdir /usr/share/tesseract-ocr-original && \
|
|
|
|
cp -r /usr/share/tesseract-ocr/* /usr/share/tesseract-ocr-original && \
|
|
|
|
mv /usr/share/tesseract-ocr-original/4.00/tessdata/eng.traineddata /usr/share/tesseract-ocr-original/4.00/tessdata/english.traineddata && \
|
|
|
|
rm -rf /usr/share/tesseract-ocr
|
|
|
|
|
|
|
|
# Python packages stage
|
|
|
|
FROM base AS python-packages
|
2023-04-26 14:18:24 +02:00
|
|
|
RUN apt-get update && \
|
|
|
|
apt-get install -y --no-install-recommends \
|
2023-04-29 00:18:10 +02:00
|
|
|
build-essential \
|
|
|
|
libffi-dev \
|
|
|
|
libssl-dev \
|
2023-04-26 14:18:24 +02:00
|
|
|
zlib1g-dev \
|
2023-04-29 00:18:10 +02:00
|
|
|
libjpeg-dev && \
|
|
|
|
pip install --upgrade pip && \
|
|
|
|
pip install --no-cache-dir \
|
|
|
|
opencv-python-headless && \
|
|
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
# Final stage: Copy necessary files from the previous stage
|
|
|
|
FROM base
|
|
|
|
COPY --from=python-packages /usr/local /usr/local
|
2023-04-15 22:17:47 +02:00
|
|
|
COPY --from=jbig2enc_builder /usr/local/bin/jbig2 /usr/local/bin/jbig2
|