mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2025-05-23 18:32:01 +00:00
Update Dockerfile2
This commit is contained in:
parent
3853ad2400
commit
2d4970ce55
109
Dockerfile2
109
Dockerfile2
@ -27,53 +27,82 @@ RUN curl -s https://api.github.com/repos/Stirling-Tools/Stirling-PDF/releases/la
|
|||||||
| xargs curl -L -o Stirling-PDF.jar
|
| xargs curl -L -o Stirling-PDF.jar
|
||||||
|
|
||||||
|
|
||||||
# Use the base image
|
# Main stage
|
||||||
FROM frooodle/stirling-pdf-base:version8
|
FROM alpine:3.21.2@sha256:56fa17d2a7e7f168a043a2712e63aed1f8543aeafdcee47c58dcffe38ed51099
|
||||||
|
|
||||||
ARG VERSION_TAG
|
|
||||||
|
|
||||||
|
|
||||||
# Set Environment Variables
|
|
||||||
ENV DOCKER_ENABLE_SECURITY=false \
|
|
||||||
HOME=/home/stirlingpdfuser \
|
|
||||||
VERSION_TAG=$VERSION_TAG \
|
|
||||||
JAVA_TOOL_OPTIONS="$JAVA_TOOL_OPTIONS -XX:MaxRAMPercentage=75"
|
|
||||||
# PUID=1000 \
|
|
||||||
# PGID=1000 \
|
|
||||||
# UMASK=022 \
|
|
||||||
|
|
||||||
|
|
||||||
# Create user and group
|
|
||||||
##RUN groupadd -g $PGID stirlingpdfgroup && \
|
|
||||||
## useradd -u $PUID -g stirlingpdfgroup -s /bin/sh stirlingpdfuser && \
|
|
||||||
## mkdir -p $HOME && chown stirlingpdfuser:stirlingpdfgroup $HOME
|
|
||||||
|
|
||||||
# Set up necessary directories and permissions
|
|
||||||
RUN mkdir -p /scripts /usr/share/fonts/opentype/noto /usr/share/tesseract-ocr /configs /customFiles
|
|
||||||
##&& \
|
|
||||||
## chown -R stirlingpdfuser:stirlingpdfgroup /scripts /usr/share/fonts/opentype/noto /usr/share/tesseract-ocr /configs /customFiles && \
|
|
||||||
## chown -R stirlingpdfuser:stirlingpdfgroup /usr/share/tesseract-ocr-original
|
|
||||||
|
|
||||||
# Copy the already-converted scripts from the dos2unix stage
|
|
||||||
COPY --from=dos2unix-converter /dos2unix-scripts/ /scripts/
|
|
||||||
# Copy necessary files
|
# Copy necessary files
|
||||||
# COPY src/main/resources/static/fonts/*.ttf /usr/share/fonts/opentype/noto/
|
COPY scripts /scripts
|
||||||
# COPY src/main/resources/static/fonts/*.otf /usr/share/fonts/opentype/noto/
|
COPY pipeline /pipeline
|
||||||
|
COPY src/main/resources/static/fonts/*.ttf /usr/share/fonts/opentype/noto/
|
||||||
|
|
||||||
# Copy the application JAR file from the download stage
|
# Copy the application JAR file from the download stage
|
||||||
COPY --from=downloader /downloader/Stirling-PDF.jar /app.jar
|
COPY --from=downloader /downloader/Stirling-PDF.jar /app.jar
|
||||||
|
|
||||||
# Set font cache and permissions
|
ARG VERSION_TAG
|
||||||
RUN fc-cache -f -v && chmod +x /scripts/*
|
|
||||||
|
|
||||||
##&& \
|
# Set Environment Variables
|
||||||
## chown stirlingpdfuser:stirlingpdfgroup /app.jar && \
|
ENV DOCKER_ENABLE_SECURITY=false \
|
||||||
## chmod +x /scripts/init.sh
|
VERSION_TAG=$VERSION_TAG \
|
||||||
|
JAVA_TOOL_OPTIONS="-XX:+UnlockExperimentalVMOptions \
|
||||||
|
-XX:MaxRAMPercentage=75 \
|
||||||
|
-XX:InitiatingHeapOccupancyPercent=20 \
|
||||||
|
-XX:+G1PeriodicGCInvokesConcurrent \
|
||||||
|
-XX:G1PeriodicGCInterval=10000 \
|
||||||
|
-XX:+UseStringDeduplication \
|
||||||
|
-XX:G1PeriodicGCSystemLoadThreshold=70" \
|
||||||
|
HOME=/home/stirlingpdfuser \
|
||||||
|
PUID=1000 \
|
||||||
|
PGID=1000 \
|
||||||
|
UMASK=022 \
|
||||||
|
FAT_DOCKER=true \
|
||||||
|
INSTALL_BOOK_AND_ADVANCED_HTML_OPS=false
|
||||||
|
|
||||||
# Expose necessary ports
|
|
||||||
EXPOSE 8080
|
# JDK for app
|
||||||
|
RUN echo "@testing https://dl-cdn.alpinelinux.org/alpine/edge/main" | tee -a /etc/apk/repositories && \
|
||||||
|
echo "@testing https://dl-cdn.alpinelinux.org/alpine/edge/community" | tee -a /etc/apk/repositories && \
|
||||||
|
echo "@testing https://dl-cdn.alpinelinux.org/alpine/edge/testing" | tee -a /etc/apk/repositories && \
|
||||||
|
apk upgrade --no-cache -a && \
|
||||||
|
apk add --no-cache \
|
||||||
|
ca-certificates \
|
||||||
|
tzdata \
|
||||||
|
tini \
|
||||||
|
bash \
|
||||||
|
curl \
|
||||||
|
shadow \
|
||||||
|
su-exec \
|
||||||
|
openssl \
|
||||||
|
openssl-dev \
|
||||||
|
openjdk21-jre \
|
||||||
|
# Doc conversion
|
||||||
|
gcompat \
|
||||||
|
libc6-compat \
|
||||||
|
libreoffice \
|
||||||
|
# pdftohtml
|
||||||
|
poppler-utils \
|
||||||
|
# OCR MY PDF (unpaper for descew and other advanced featues)
|
||||||
|
qpdf \
|
||||||
|
tesseract-ocr-data-eng \
|
||||||
|
font-terminus font-dejavu font-noto font-noto-cjk font-awesome font-noto-extra \
|
||||||
|
# CV
|
||||||
|
py3-opencv \
|
||||||
|
# python3/pip
|
||||||
|
python3 \
|
||||||
|
py3-pip && \
|
||||||
|
# uno unoconv and HTML
|
||||||
|
pip install --break-system-packages --no-cache-dir --upgrade unoconv WeasyPrint pdf2image pillow && \
|
||||||
|
mv /usr/share/tessdata /usr/share/tessdata-original && \
|
||||||
|
mkdir -p $HOME /configs /logs /customFiles /pipeline/watchedFolders /pipeline/finishedFolders && \
|
||||||
|
fc-cache -f -v && \
|
||||||
|
chmod +x /scripts/* && \
|
||||||
|
chmod +x /scripts/init.sh && \
|
||||||
|
# User permissions
|
||||||
|
addgroup -S stirlingpdfgroup && adduser -S stirlingpdfuser -G stirlingpdfgroup && \
|
||||||
|
chown -R stirlingpdfuser:stirlingpdfgroup $HOME /scripts /usr/share/fonts/opentype/noto /configs /customFiles /pipeline && \
|
||||||
|
chown stirlingpdfuser:stirlingpdfgroup /app.jar
|
||||||
|
|
||||||
|
EXPOSE 8080/tcp
|
||||||
|
|
||||||
# Set user and run command
|
# Set user and run command
|
||||||
##USER stirlingpdfuser
|
ENTRYPOINT ["tini", "--", "/scripts/init.sh"]
|
||||||
ENTRYPOINT ["/scripts/init.sh"]
|
CMD ["java", "-Dfile.encoding=UTF-8", "-jar", "/app.jar"]
|
||||||
CMD ["java", "-jar", "/app.jar"]
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user