|
|
FROM openjdk:17-jdk-slim |
|
|
|
|
|
WORKDIR /app |
|
|
|
|
|
|
|
|
RUN apt-get update && apt-get install -y \ |
|
|
git \ |
|
|
curl \ |
|
|
wget \ |
|
|
gradle \ |
|
|
maven \ |
|
|
libreoffice \ |
|
|
poppler-utils \ |
|
|
tesseract-ocr \ |
|
|
tesseract-ocr-eng \ |
|
|
python3 \ |
|
|
python3-pip && \ |
|
|
pip3 install --no-cache-dir unoconv WeasyPrint pdf2image pillow && \ |
|
|
rm -rf /var/lib/apt/lists/* |
|
|
|
|
|
|
|
|
RUN mkdir -p /usr/share/tessdata && \ |
|
|
cd /usr/share/tessdata && \ |
|
|
wget -q https://github.com/tesseract-ocr/tessdata/raw/main/chi_sim.traineddata && \ |
|
|
wget -q https://github.com/tesseract-ocr/tessdata/raw/main/chi_tra.traineddata && \ |
|
|
wget -q https://github.com/tesseract-ocr/tessdata/raw/main/eng.traineddata && \ |
|
|
wget -q https://github.com/tesseract-ocr/tessdata/raw/main/jpn.traineddata && \ |
|
|
wget -q https://github.com/tesseract-ocr/tessdata/raw/main/kor.traineddata && \ |
|
|
wget -q https://github.com/tesseract-ocr/tessdata/raw/main/rus.traineddata && \ |
|
|
wget -q https://github.com/tesseract-ocr/tessdata/raw/main/fra.traineddata && \ |
|
|
wget -q https://github.com/tesseract-ocr/tessdata/raw/main/deu.traineddata && \ |
|
|
wget -q https://github.com/tesseract-ocr/tessdata/raw/main/spa.traineddata && \ |
|
|
wget -q https://github.com/tesseract-ocr/tessdata/raw/main/ita.traineddata && \ |
|
|
wget -q https://github.com/tesseract-ocr/tessdata/raw/main/por.traineddata && \ |
|
|
wget -q https://github.com/tesseract-ocr/tessdata/raw/main/vie.traineddata && \ |
|
|
wget -q https://github.com/tesseract-ocr/tessdata/raw/main/tha.traineddata |
|
|
|
|
|
|
|
|
RUN cd /tmp && \ |
|
|
git clone https://github.com/Stirling-Tools/Stirling-PDF.git stirling-pdf && \ |
|
|
cd stirling-pdf && \ |
|
|
./gradlew build && \ |
|
|
cp stirling-pdf/build/libs/*.jar /app/stirling-pdf.jar && \ |
|
|
cd / && \ |
|
|
rm -rf /tmp/stirling-pdf ~/.gradle /tmp/* && \ |
|
|
apt-get remove -y git gradle maven && \ |
|
|
apt-get autoremove -y && \ |
|
|
apt-get clean |
|
|
|
|
|
|
|
|
RUN mkdir -p /app/logs /app/configs /app/customFiles && \ |
|
|
chmod -R 777 /app/logs /app/configs /app/customFiles /usr/share/tessdata |
|
|
|
|
|
|
|
|
ENV JAVA_TOOL_OPTIONS="-XX:MaxRAMPercentage=75" |
|
|
ENV TESSDATA_PREFIX="/usr/share/tessdata" |
|
|
|
|
|
|
|
|
EXPOSE 7860 |
|
|
|
|
|
|
|
|
CMD ["java", "-Dserver.port=7860", "-Dserver.address=0.0.0.0", "-Dfile.encoding=UTF-8", "-jar", "/app/stirling-pdf.jar"] |