Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3bffc1da76 | ||
|
|
631d3948bd |
@@ -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"]
|
||||||
|
|||||||
@@ -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"]
|
||||||
|
|||||||
@@ -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 | | ✔️ | ✔️
|
||||||
|
|||||||
24
build.gradle
24
build.gradle
@@ -2,13 +2,13 @@ plugins {
|
|||||||
id 'java'
|
id 'java'
|
||||||
id 'org.springframework.boot' version '3.1.2'
|
id 'org.springframework.boot' version '3.1.2'
|
||||||
id 'io.spring.dependency-management' version '1.1.3'
|
id 'io.spring.dependency-management' version '1.1.3'
|
||||||
id 'org.springdoc.openapi-gradle-plugin' version '1.6.0'
|
id 'org.springdoc.openapi-gradle-plugin' version '1.8.0'
|
||||||
id "io.swagger.swaggerhub" version "1.2.0"
|
id "io.swagger.swaggerhub" version "1.2.0"
|
||||||
id 'edu.sc.seis.launch4j' version '3.0.5'
|
id 'edu.sc.seis.launch4j' version '3.0.5'
|
||||||
}
|
}
|
||||||
|
|
||||||
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")
|
||||||
@@ -87,15 +86,24 @@ dependencies {
|
|||||||
implementation group: 'org.apache.pdfbox', name: 'jbig2-imageio', version: '3.0.4'
|
implementation group: 'org.apache.pdfbox', name: 'jbig2-imageio', version: '3.0.4'
|
||||||
implementation 'com.github.jai-imageio:jai-imageio-core:1.4.0'
|
implementation 'com.github.jai-imageio:jai-imageio-core:1.4.0'
|
||||||
implementation 'com.github.jai-imageio:jai-imageio-jpeg2000:1.3.0'
|
implementation 'com.github.jai-imageio:jai-imageio-jpeg2000:1.3.0'
|
||||||
implementation 'commons-io:commons-io:2.13.0'
|
implementation 'commons-io:commons-io:2.15.1'
|
||||||
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.2.0'
|
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.2.0'
|
||||||
|
|
||||||
//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'
|
||||||
@@ -107,7 +115,7 @@ dependencies {
|
|||||||
implementation 'com.github.vladimir-bukhtoyarov:bucket4j-core:7.6.0'
|
implementation 'com.github.vladimir-bukhtoyarov:bucket4j-core:7.6.0'
|
||||||
|
|
||||||
developmentOnly("org.springframework.boot:spring-boot-devtools")
|
developmentOnly("org.springframework.boot:spring-boot-devtools")
|
||||||
compileOnly 'org.projectlombok:lombok:1.18.28'
|
compileOnly 'org.projectlombok:lombok:1.18.30'
|
||||||
annotationProcessor 'org.projectlombok:lombok:1.18.28'
|
annotationProcessor 'org.projectlombok:lombok:1.18.28'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
19
scripts/download-security-jar.sh
Normal file
19
scripts/download-security-jar.sh
Normal 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
|
||||||
6
scripts/init-without-ocr.sh
Normal file
6
scripts/init-without-ocr.sh
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
/scripts/download-security-jar.sh
|
||||||
|
|
||||||
|
# Run the main command
|
||||||
|
exec "$@"
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
# Copy the original tesseract-ocr files to the volume directory without overwriting existing files
|
# Copy the original tesseract-ocr files to the volume directory without overwriting existing files
|
||||||
echo "Copying original files without overwriting existing files"
|
echo "Copying original files without overwriting existing files"
|
||||||
mkdir -p /usr/share/tesseract-ocr
|
mkdir -p /usr/share/tesseract-ocr
|
||||||
cp -rn /usr/share/tesseract-ocr-original/* /usr/share/tesseract-ocr
|
cp -rn /usr/share/tesseract-ocr-original/* /usr/share/tesseract-ocr
|
||||||
|
|
||||||
if [ -d /usr/share/tesseract-ocr/4.00/tessdata ]; then
|
if [ -d /usr/share/tesseract-ocr/4.00/tessdata ]; then
|
||||||
cp -r /usr/share/tesseract-ocr/4.00/tessdata/* /usr/share/tesseract-ocr/5/tessdata/ || true;
|
cp -r /usr/share/tesseract-ocr/4.00/tessdata/* /usr/share/tesseract-ocr/5/tessdata/ || true;
|
||||||
@@ -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 "$@"
|
||||||
@@ -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");
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
Reference in New Issue
Block a user