2023-03-20 22:55:11 +01: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 \
|
|
|
|
make \
|
|
|
|
g++
|
|
|
|
|
|
|
|
RUN git clone https://github.com/agl/jbig2enc && \
|
|
|
|
cd jbig2enc && \
|
|
|
|
./autogen.sh && \
|
|
|
|
./configure && \
|
|
|
|
make && \
|
|
|
|
make install
|
|
|
|
|
|
|
|
# Main stage
|
2023-01-27 19:23:40 +01:00
|
|
|
FROM openjdk:17-jdk-slim
|
2023-03-20 22:55:11 +01:00
|
|
|
|
|
|
|
# Install necessary dependencies
|
|
|
|
RUN apt-get update && \
|
|
|
|
apt-get install -y --no-install-recommends \
|
|
|
|
libreoffice-core \
|
|
|
|
libreoffice-common \
|
|
|
|
libreoffice-writer \
|
|
|
|
libreoffice-calc \
|
|
|
|
libreoffice-impress \
|
|
|
|
python3-uno \
|
|
|
|
python3-pip \
|
|
|
|
unoconv \
|
|
|
|
pngquant \
|
2023-04-01 22:02:54 +02:00
|
|
|
unpaper \
|
2023-03-20 22:55:11 +01:00
|
|
|
ocrmypdf && \
|
|
|
|
pip install --user --upgrade ocrmypdf
|
|
|
|
|
|
|
|
# Copy the jbig2enc binary from the builder stage
|
|
|
|
COPY --from=jbig2enc_builder /usr/local/bin/jbig2 /usr/local/bin/jbig2
|
|
|
|
|
|
|
|
# Copy the application JAR file
|
2023-01-27 19:23:40 +01:00
|
|
|
COPY build/libs/*.jar app.jar
|
2023-03-20 22:55:11 +01:00
|
|
|
|
|
|
|
# Expose the application port
|
2023-01-27 19:23:40 +01:00
|
|
|
EXPOSE 8080
|
2023-03-20 22:55:11 +01:00
|
|
|
|
|
|
|
# Set environment variables
|
2023-04-01 22:02:54 +02:00
|
|
|
ENV APP_NAME="Stirling PDF"
|
2023-03-20 22:55:11 +01:00
|
|
|
|
|
|
|
# Run the application
|
2023-04-01 22:02:54 +02:00
|
|
|
ENTRYPOINT java -jar /app.jar
|
2023-03-20 22:55:11 +01:00
|
|
|
|
|
|
|
|
|
|
|
|