fix for #531 plus seperated out some things

This commit is contained in:
Anthony Stirling 2023-12-18 14:52:18 +00:00
parent 5774a22b64
commit 631d3948bd
9 changed files with 74 additions and 31 deletions

View file

@ -30,12 +30,18 @@ RUN mkdir -p /scripts /usr/share/fonts/opentype/noto /configs /customFiles
# chown -R stirlingpdfuser:stirlingpdfgroup /usr/share/fonts/opentype/noto /configs /customFiles # chown -R stirlingpdfuser:stirlingpdfgroup /usr/share/fonts/opentype/noto /configs /customFiles
# Copy necessary files # Copy necessary files
COPY ./scripts/download-security-jar.sh /scripts/download-security-jar.sh
COPY ./scripts/init-without-ocr.sh /scripts/init-without-ocr.sh
COPY src/main/resources/static/fonts/*.ttf /usr/share/fonts/opentype/noto/ COPY src/main/resources/static/fonts/*.ttf /usr/share/fonts/opentype/noto/
COPY src/main/resources/static/fonts/*.otf /usr/share/fonts/opentype/noto/ COPY src/main/resources/static/fonts/*.otf /usr/share/fonts/opentype/noto/
COPY build/libs/*.jar app.jar COPY build/libs/*.jar app.jar
# Set font cache and permissions # Set font cache and permissions
RUN fc-cache -f -v RUN fc-cache -f -v && \
chmod +x /scripts/init-without-ocr.sh && \
chmod +x /scripts/download-security-jar.sh
# chown stirlingpdfuser:stirlingpdfgroup /app.jar # chown stirlingpdfuser:stirlingpdfgroup /app.jar
@ -50,5 +56,5 @@ ENV DOCKER_ENABLE_SECURITY=false
# Run the application # Run the application
#USER stirlingpdfuser #USER stirlingpdfuser
ENTRYPOINT ["/scripts/init.sh"] ENTRYPOINT ["/scripts/init-without-ocr.sh"]
CMD ["java", "-jar", "/app.jar"] CMD ["java", "-jar", "/app.jar"]

View file

@ -19,19 +19,25 @@ ENV DOCKER_ENABLE_SECURITY=false \
# chown -R stirlingpdfuser:stirlingpdfgroup /scripts /configs /customFiles # chown -R stirlingpdfuser:stirlingpdfgroup /scripts /configs /customFiles
RUN mkdir -p /scripts /usr/share/fonts/opentype/noto /configs /customFiles RUN mkdir -p /scripts /usr/share/fonts/opentype/noto /configs /customFiles
COPY ./scripts/download-security-jar.sh /scripts/download-security-jar.sh
COPY ./scripts/init-without-ocr.sh /scripts/init-without-ocr.sh
COPY build/libs/*.jar app.jar COPY build/libs/*.jar app.jar
# Set font cache and permissions # Set font cache and permissions
#RUN chown stirlingpdfuser:stirlingpdfgroup /app.jar #RUN chown stirlingpdfuser:stirlingpdfgroup /app.jar
RUN chmod +x /scripts/init-without-ocr.sh && \
chmod +x /scripts/download-security-jar.sh && \
apk add --no-cache curl
# Expose the application port # Expose the application port
EXPOSE 8080 EXPOSE 8080
# Set environment variables # Set environment variables
ENV ENDPOINTS_GROUPS_TO_REMOVE=CLI ENV ENDPOINTS_GROUPS_TO_REMOVE=CLI
ENTRYPOINT ["/scripts/init.sh"] ENTRYPOINT ["/scripts/init-without-ocr.sh"]
# Run the application # Run the application
CMD ["java", "-jar", "/app.jar"] CMD ["java", "-jar", "/app.jar"]

View file

@ -19,6 +19,7 @@ add-image | ✔️ | ✔️ | ✔️
add-watermark | ✔️ | ✔️ | ✔️ add-watermark | ✔️ | ✔️ | ✔️
adjust-contrast | ✔️ | ✔️ | ✔️ adjust-contrast | ✔️ | ✔️ | ✔️
auto-split-pdf | ✔️ | ✔️ | ✔️ auto-split-pdf | ✔️ | ✔️ | ✔️
auto-redact | ✔️ | ✔️ | ✔️
auto-rename | ✔️ | ✔️ | ✔️ auto-rename | ✔️ | ✔️ | ✔️
cert-sign | ✔️ | ✔️ | ✔️ cert-sign | ✔️ | ✔️ | ✔️
crop | ✔️ | ✔️ | ✔️ crop | ✔️ | ✔️ | ✔️
@ -33,7 +34,9 @@ img-to-pdf | ✔️ | ✔️ | ✔️
markdown-to-pdf | ✔️ | ✔️ | ✔️ markdown-to-pdf | ✔️ | ✔️ | ✔️
merge-pdfs | ✔️ | ✔️ | ✔️ merge-pdfs | ✔️ | ✔️ | ✔️
multi-page-layout | ✔️ | ✔️ | ✔️ multi-page-layout | ✔️ | ✔️ | ✔️
overlay-pdf | ✔️ | ✔️ | ✔️
pdf-organizer | ✔️ | ✔️ | ✔️ pdf-organizer | ✔️ | ✔️ | ✔️
pdf-to-csv | ✔️ | ✔️ | ✔️
pdf-to-img | ✔️ | ✔️ | ✔️ pdf-to-img | ✔️ | ✔️ | ✔️
pdf-to-single-page | ✔️ | ✔️ | ✔️ pdf-to-single-page | ✔️ | ✔️ | ✔️
remove-pages | ✔️ | ✔️ | ✔️ remove-pages | ✔️ | ✔️ | ✔️
@ -43,6 +46,8 @@ sanitize-pdf | ✔️ | ✔️ | ✔️
scale-pages | ✔️ | ✔️ | ✔️ scale-pages | ✔️ | ✔️ | ✔️
sign | ✔️ | ✔️ | ✔️ sign | ✔️ | ✔️ | ✔️
show-javascript | ✔️ | ✔️ | ✔️ show-javascript | ✔️ | ✔️ | ✔️
split-by-size-or-count | ✔️ | ✔️ | ✔️
split-pdf-by-sections | ✔️ | ✔️ | ✔️
split-pdfs | ✔️ | ✔️ | ✔️ split-pdfs | ✔️ | ✔️ | ✔️
file-to-pdf | | ✔️ | ✔️ file-to-pdf | | ✔️ | ✔️
pdf-to-html | | ✔️ | ✔️ pdf-to-html | | ✔️ | ✔️

View file

@ -8,7 +8,7 @@ plugins {
} }
group = 'stirling.software' group = 'stirling.software'
version = '0.17.1' version = '0.17.2'
sourceCompatibility = '17' sourceCompatibility = '17'
repositories { repositories {
@ -32,7 +32,6 @@ sourceSets {
} }
} }
openApi { openApi {
apiDocsUrl = "http://localhost:8080/v1/api-docs" apiDocsUrl = "http://localhost:8080/v1/api-docs"
outputDir = file("$projectDir") outputDir = file("$projectDir")
@ -93,9 +92,18 @@ dependencies {
//general PDF //general PDF
// https://mvnrepository.com/artifact/com.opencsv/opencsv // https://mvnrepository.com/artifact/com.opencsv/opencsv
implementation group: 'com.opencsv', name: 'opencsv', version: '5.7.1' implementation ('com.opencsv:opencsv:5.7.1') {
implementation 'org.apache.pdfbox:pdfbox:2.0.29' exclude group: 'commons-logging', module: 'commons-logging'
implementation 'org.apache.pdfbox:xmpbox:2.0.29' }
implementation ('org.apache.pdfbox:pdfbox:2.0.29'){
exclude group: 'commons-logging', module: 'commons-logging'
}
implementation ('org.apache.pdfbox:xmpbox:2.0.29'){
exclude group: 'commons-logging', module: 'commons-logging'
}
implementation 'org.bouncycastle:bcprov-jdk18on:1.77' implementation 'org.bouncycastle:bcprov-jdk18on:1.77'
implementation 'org.bouncycastle:bcpkix-jdk18on:1.77' implementation 'org.bouncycastle:bcpkix-jdk18on:1.77'
implementation 'org.springframework.boot:spring-boot-starter-actuator' implementation 'org.springframework.boot:spring-boot-starter-actuator'

View file

@ -0,0 +1,19 @@
echo "Running Stirling PDF with DOCKER_ENABLE_SECURITY=${DOCKER_ENABLE_SECURITY} and VERSION_TAG=${VERSION_TAG}"
# Check for DOCKER_ENABLE_SECURITY and download the appropriate JAR if required
if [ "$DOCKER_ENABLE_SECURITY" = "true" ] && [ "$VERSION_TAG" != "alpha" ]; then
if [ ! -f app-security.jar ]; then
echo "Trying to download from: https://github.com/Frooodle/Stirling-PDF/releases/download/v$VERSION_TAG/Stirling-PDF-with-login.jar"
curl -L -o app-security.jar https://github.com/Frooodle/Stirling-PDF/releases/download/v$VERSION_TAG/Stirling-PDF-with-login.jar
# If the first download attempt failed, try with the 'v' prefix
if [ $? -ne 0 ]; then
echo "Trying to download from: https://github.com/Frooodle/Stirling-PDF/releases/download/$VERSION_TAG/Stirling-PDF-with-login.jar"
curl -L -o app-security.jar https://github.com/Frooodle/Stirling-PDF/releases/download/$VERSION_TAG/Stirling-PDF-with-login.jar
fi
if [ $? -eq 0 ]; then # checks if curl was successful
rm -f app.jar
ln -s app-security.jar app.jar
fi
fi
fi

View file

@ -0,0 +1,6 @@
#!/bin/sh
/scripts/download-security-jar.sh
# Run the main command
exec "$@"

View file

@ -20,26 +20,7 @@ if [[ -n "$TESSERACT_LANGS" ]]; then
done done
fi fi
echo "Running Stirling PDF with DOCKER_ENABLE_SECURITY=${DOCKER_ENABLE_SECURITY} and VERSION_TAG=${VERSION_TAG}" /scripts/download-security-jar.sh
# Check for DOCKER_ENABLE_SECURITY and download the appropriate JAR if required
if [ "$DOCKER_ENABLE_SECURITY" = "true" ] && [ "$VERSION_TAG" != "alpha" ]; then
if [ ! -f app-security.jar ]; then
echo "Trying to download from: https://github.com/Frooodle/Stirling-PDF/releases/download/v$VERSION_TAG/Stirling-PDF-with-login.jar"
curl -L -o app-security.jar https://github.com/Frooodle/Stirling-PDF/releases/download/v$VERSION_TAG/Stirling-PDF-with-login.jar
# If the first download attempt failed, try with the 'v' prefix
if [ $? -ne 0 ]; then
echo "Trying to download from: https://github.com/Frooodle/Stirling-PDF/releases/download/$VERSION_TAG/Stirling-PDF-with-login.jar"
curl -L -o app-security.jar https://github.com/Frooodle/Stirling-PDF/releases/download/$VERSION_TAG/Stirling-PDF-with-login.jar
fi
if [ $? -eq 0 ]; then # checks if curl was successful
rm -f app.jar
ln -s app-security.jar app.jar
fi
fi
fi
# Run the main command # Run the main command
exec "$@" exec "$@"

View file

@ -81,6 +81,10 @@ public class EndpointConfiguration {
addEndpointToGroup("PageOps", "auto-split-pdf"); addEndpointToGroup("PageOps", "auto-split-pdf");
addEndpointToGroup("PageOps", "extract-page"); addEndpointToGroup("PageOps", "extract-page");
addEndpointToGroup("PageOps", "pdf-to-single-page"); addEndpointToGroup("PageOps", "pdf-to-single-page");
addEndpointToGroup("PageOps", "split-by-size-or-count");
addEndpointToGroup("PageOps", "overlay-pdf");
addEndpointToGroup("PageOps", "split-pdf-by-sections");
// Adding endpoints to "Convert" group // Adding endpoints to "Convert" group
addEndpointToGroup("Convert", "pdf-to-img"); addEndpointToGroup("Convert", "pdf-to-img");
@ -96,6 +100,8 @@ public class EndpointConfiguration {
addEndpointToGroup("Convert", "html-to-pdf"); addEndpointToGroup("Convert", "html-to-pdf");
addEndpointToGroup("Convert", "url-to-pdf"); addEndpointToGroup("Convert", "url-to-pdf");
addEndpointToGroup("Convert", "markdown-to-pdf"); addEndpointToGroup("Convert", "markdown-to-pdf");
addEndpointToGroup("Convert", "pdf-to-csv");
// Adding endpoints to "Security" group // Adding endpoints to "Security" group
addEndpointToGroup("Security", "add-password"); addEndpointToGroup("Security", "add-password");
@ -104,6 +110,7 @@ public class EndpointConfiguration {
addEndpointToGroup("Security", "add-watermark"); addEndpointToGroup("Security", "add-watermark");
addEndpointToGroup("Security", "cert-sign"); addEndpointToGroup("Security", "cert-sign");
addEndpointToGroup("Security", "sanitize-pdf"); addEndpointToGroup("Security", "sanitize-pdf");
addEndpointToGroup("Security", "auto-redact");
// Adding endpoints to "Other" group // Adding endpoints to "Other" group
@ -197,6 +204,11 @@ public class EndpointConfiguration {
addEndpointToGroup("Java", "pdf-to-single-page"); addEndpointToGroup("Java", "pdf-to-single-page");
addEndpointToGroup("Java", "markdown-to-pdf"); addEndpointToGroup("Java", "markdown-to-pdf");
addEndpointToGroup("Java", "show-javascript"); addEndpointToGroup("Java", "show-javascript");
addEndpointToGroup("Java", "auto-redact");
addEndpointToGroup("Java", "pdf-to-csv");
addEndpointToGroup("Java", "split-by-size-or-count");
addEndpointToGroup("Java", "overlay-pdf");
addEndpointToGroup("Java", "split-pdf-by-sections");
//Javascript //Javascript
addEndpointToGroup("Javascript", "pdf-organizer"); addEndpointToGroup("Javascript", "pdf-organizer");

View file

@ -16,7 +16,7 @@
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- daily rollover and keep 7 days' worth of history --> <!-- daily rollover and keep 7 days' worth of history -->
<fileNamePattern>auth-%d{MM-dd-yyyy}.log</fileNamePattern> <fileNamePattern>logs/auth-%d{yyyy-MM-dd}.log</fileNamePattern>
<maxHistory>1</maxHistory> <maxHistory>1</maxHistory>
</rollingPolicy> </rollingPolicy>
</appender> </appender>
@ -30,7 +30,7 @@
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- daily rollover and keep 7 days' worth of history --> <!-- daily rollover and keep 7 days' worth of history -->
<fileNamePattern>info-%d{MM-dd-yyyy}.log</fileNamePattern> <fileNamePattern>logs/info-%d{yyyy-MM-dd}.log</fileNamePattern>
<maxHistory>1</maxHistory> <maxHistory>1</maxHistory>
</rollingPolicy> </rollingPolicy>
</appender> </appender>