iatiah commited on
Commit
aef1493
·
verified ·
1 Parent(s): 981d882

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +64 -0
Dockerfile ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM openjdk:17-jdk-slim AS builder
2
+
3
+ WORKDIR /app
4
+
5
+ RUN apt-get update && apt-get install -y \
6
+ git \
7
+ curl \
8
+ gradle \
9
+ maven
10
+
11
+ RUN git clone https://github.com/Stirling-Tools/Stirling-PDF.git .
12
+
13
+ RUN ./gradlew build
14
+
15
+ FROM openjdk:17-jdk-slim
16
+
17
+ WORKDIR /app
18
+
19
+ COPY --from=builder /app/build/libs/*.jar /app/stirling-pdf.jar
20
+
21
+ RUN useradd -m -d /home/appuser appuser && \
22
+ mkdir -p /home/appuser/.cache/dconf && \
23
+ chown -R appuser:appuser /home/appuser && \
24
+ mkdir -p /app/logs /app/configs /app/customFiles /usr/share/tessdata && \
25
+ chmod -R 777 /app/logs /app/configs /app/customFiles /usr/share/tessdata
26
+
27
+ RUN apt-get update && apt-get install -y \
28
+ libreoffice \
29
+ poppler-utils \
30
+ tesseract-ocr \
31
+ tesseract-ocr-eng \
32
+ wget \
33
+ python3 \
34
+ python3-pip && \
35
+ pip3 install --no-cache-dir unoconv WeasyPrint pdf2image pillow && \
36
+ cd /usr/share/tessdata && \
37
+ wget https://github.com/tesseract-ocr/tessdata/raw/main/chi_sim.traineddata && \
38
+ wget https://github.com/tesseract-ocr/tessdata/raw/main/chi_tra.traineddata && \
39
+ wget https://github.com/tesseract-ocr/tessdata/raw/main/eng.traineddata && \
40
+ wget https://github.com/tesseract-ocr/tessdata/raw/main/jpn.traineddata && \
41
+ wget https://github.com/tesseract-ocr/tessdata/raw/main/kor.traineddata && \
42
+ wget https://github.com/tesseract-ocr/tessdata/raw/main/rus.traineddata && \
43
+ wget https://github.com/tesseract-ocr/tessdata/raw/main/fra.traineddata && \
44
+ wget https://github.com/tesseract-ocr/tessdata/raw/main/deu.traineddata && \
45
+ wget https://github.com/tesseract-ocr/tessdata/raw/main/spa.traineddata && \
46
+ wget https://github.com/tesseract-ocr/tessdata/raw/main/ita.traineddata && \
47
+ wget https://github.com/tesseract-ocr/tessdata/raw/main/por.traineddata && \
48
+ wget https://github.com/tesseract-ocr/tessdata/raw/main/vie.traineddata && \
49
+ wget https://github.com/tesseract-ocr/tessdata/raw/main/tha.traineddata && \
50
+ rm -rf /var/lib/apt/lists/*
51
+
52
+ ENV HOME=/home/appuser \
53
+ XDG_RUNTIME_DIR=/tmp/runtime-appuser \
54
+ LIBREOFFICE_CONFIG_DIR=/tmp/libreoffice
55
+
56
+ RUN mkdir -p ${XDG_RUNTIME_DIR} ${LIBREOFFICE_CONFIG_DIR} && \
57
+ chown -R appuser:appuser ${XDG_RUNTIME_DIR} ${LIBREOFFICE_CONFIG_DIR} && \
58
+ chmod 777 ${XDG_RUNTIME_DIR} ${LIBREOFFICE_CONFIG_DIR}
59
+
60
+ USER appuser
61
+
62
+ EXPOSE 7860
63
+
64
+ CMD ["java", "-Dserver.port=7860", "-Dserver.address=0.0.0.0", "-Dfile.encoding=UTF-8", "-jar", "/app/stirling-pdf.jar"]