mirror of
https://github.com/arsvendg/Stirling-PDF.git
synced 2026-07-14 10:34:06 +02:00
feat(docker): update base images to Java 25, Spring 4, Jackson 3, Gradle 9 and optimize JVM options (Project Lilliput) (#5725)
Co-authored-by: Anthony Stirling <[email protected]>
This commit is contained in:
co-authored by
Anthony Stirling
parent
24128dd318
commit
1f9b90ad57
@@ -1,8 +1,8 @@
|
||||
services:
|
||||
backend:
|
||||
stirling-pdf:
|
||||
build:
|
||||
context: ../..
|
||||
dockerfile: docker/backend/Dockerfile
|
||||
dockerfile: docker/embedded/Dockerfile
|
||||
container_name: Stirling-PDF-Security-with-login
|
||||
restart: unless-stopped
|
||||
deploy:
|
||||
@@ -38,21 +38,6 @@ services:
|
||||
networks:
|
||||
- stirling-network
|
||||
|
||||
frontend:
|
||||
build:
|
||||
context: ../..
|
||||
dockerfile: docker/frontend/Dockerfile
|
||||
container_name: stirling-pdf-frontend-security-login
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "3000:80"
|
||||
environment:
|
||||
BACKEND_URL: http://backend:8080
|
||||
depends_on:
|
||||
- backend
|
||||
networks:
|
||||
- stirling-network
|
||||
|
||||
networks:
|
||||
stirling-network:
|
||||
driver: bridge
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
services:
|
||||
backend:
|
||||
stirling-pdf:
|
||||
build:
|
||||
context: ../..
|
||||
dockerfile: docker/backend/Dockerfile
|
||||
dockerfile: docker/embedded/Dockerfile
|
||||
container_name: Stirling-PDF-Security
|
||||
restart: unless-stopped
|
||||
deploy:
|
||||
@@ -34,21 +34,6 @@ services:
|
||||
networks:
|
||||
- stirling-network
|
||||
|
||||
frontend:
|
||||
build:
|
||||
context: ../..
|
||||
dockerfile: docker/frontend/Dockerfile
|
||||
container_name: stirling-pdf-frontend-security
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "3000:80"
|
||||
environment:
|
||||
BACKEND_URL: http://backend:8080
|
||||
depends_on:
|
||||
- backend
|
||||
networks:
|
||||
- stirling-network
|
||||
|
||||
networks:
|
||||
stirling-network:
|
||||
driver: bridge
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
services:
|
||||
backend:
|
||||
stirling-pdf:
|
||||
build:
|
||||
context: ../..
|
||||
dockerfile: docker/backend/Dockerfile.ultra-lite
|
||||
dockerfile: docker/embedded/Dockerfile.ultra-lite
|
||||
container_name: Stirling-PDF-Ultra-Lite
|
||||
restart: unless-stopped
|
||||
deploy:
|
||||
@@ -34,21 +34,6 @@ services:
|
||||
networks:
|
||||
- stirling-network
|
||||
|
||||
frontend:
|
||||
build:
|
||||
context: ../..
|
||||
dockerfile: docker/frontend/Dockerfile
|
||||
container_name: stirling-pdf-frontend-ultra-lite
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "3000:80"
|
||||
environment:
|
||||
BACKEND_URL: http://backend:8080
|
||||
depends_on:
|
||||
- backend
|
||||
networks:
|
||||
- stirling-network
|
||||
|
||||
networks:
|
||||
stirling-network:
|
||||
driver: bridge
|
||||
|
||||
@@ -58,7 +58,7 @@ Feature: API Validation
|
||||
| deskew | true |
|
||||
| clean | true |
|
||||
| cleanFinal | true |
|
||||
| ocrType | Force |
|
||||
| ocrType | force-ocr |
|
||||
| ocrRenderType | hocr |
|
||||
| removeImagesAfter | false |
|
||||
When I send the API request to the endpoint "/api/v1/misc/ocr-pdf"
|
||||
|
||||
@@ -136,8 +136,10 @@ Feature: Filter API Endpoints
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# filter-page-size
|
||||
# Blank pages are 72x72 points (smaller than any standard page size).
|
||||
# Pages with random text use LETTER (612x792 points).
|
||||
# Blank pages use LETTER (612x792 points = 484704 sq pts), same as pages
|
||||
# with random text. Standard page areas for reference:
|
||||
# A0 ~8031893 sq pts, A4 ~501168 sq pts, LEGAL 616896 sq pts,
|
||||
# LETTER 484704 sq pts, A6 ~124870 sq pts
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@filter-page-size @positive
|
||||
@@ -157,10 +159,21 @@ Feature: Filter API Endpoints
|
||||
| standardPageSize |
|
||||
| A0 |
|
||||
| A4 |
|
||||
| A6 |
|
||||
| LETTER |
|
||||
| LEGAL |
|
||||
|
||||
@filter-page-size @positive
|
||||
Scenario: filter-page-size returns 200 when blank PDF equals LETTER size
|
||||
Given I generate a PDF file as "fileInput"
|
||||
And the pdf contains 2 pages
|
||||
And the request data includes
|
||||
| parameter | value |
|
||||
| standardPageSize | LETTER |
|
||||
| comparator | Equal |
|
||||
When I send the API request to the endpoint "/api/v1/filter/filter-page-size"
|
||||
Then the response status code should be 200
|
||||
And the response content type should be "application/pdf"
|
||||
And the response file should have size greater than 0
|
||||
|
||||
@filter-page-size @positive
|
||||
Scenario: filter-page-size returns 200 when text PDF equals LETTER size
|
||||
Given I generate a PDF file as "fileInput"
|
||||
@@ -174,6 +187,19 @@ Feature: Filter API Endpoints
|
||||
And the response content type should be "application/pdf"
|
||||
And the response file should have size greater than 0
|
||||
|
||||
@filter-page-size @positive
|
||||
Scenario: filter-page-size returns 200 when blank PDF is Greater than A6
|
||||
Given I generate a PDF file as "fileInput"
|
||||
And the pdf contains 2 pages
|
||||
And the request data includes
|
||||
| parameter | value |
|
||||
| standardPageSize | A6 |
|
||||
| comparator | Greater |
|
||||
When I send the API request to the endpoint "/api/v1/filter/filter-page-size"
|
||||
Then the response status code should be 200
|
||||
And the response content type should be "application/pdf"
|
||||
And the response file should have size greater than 0
|
||||
|
||||
@filter-page-size @negative
|
||||
Scenario Outline: filter-page-size returns 204 when blank PDF does not match standard size as Equal
|
||||
Given I generate a PDF file as "fileInput"
|
||||
@@ -188,16 +214,15 @@ Feature: Filter API Endpoints
|
||||
Examples:
|
||||
| standardPageSize |
|
||||
| A4 |
|
||||
| LETTER |
|
||||
| LEGAL |
|
||||
|
||||
@filter-page-size @negative
|
||||
Scenario: filter-page-size returns 204 when blank PDF is not Greater than any standard size
|
||||
Scenario: filter-page-size returns 204 when blank PDF is not Greater than A4
|
||||
Given I generate a PDF file as "fileInput"
|
||||
And the pdf contains 2 pages
|
||||
And the request data includes
|
||||
| parameter | value |
|
||||
| standardPageSize | A6 |
|
||||
| parameter | value |
|
||||
| standardPageSize | A4 |
|
||||
| comparator | Greater |
|
||||
When I send the API request to the endpoint "/api/v1/filter/filter-page-size"
|
||||
Then the response status code should be 204
|
||||
|
||||
@@ -26,10 +26,18 @@ API_HEADERS = {"X-API-KEY": "123456789"}
|
||||
def step_generate_pdf(context, fileInput):
|
||||
context.param_name = fileInput
|
||||
context.file_name = "genericNonCustomisableName.pdf"
|
||||
writer = PdfWriter()
|
||||
writer.add_blank_page(width=72, height=72) # Single blank page
|
||||
# Generate a PDF with proper size and content (Letter size: 612x792 points)
|
||||
buffer = io.BytesIO()
|
||||
c = canvas.Canvas(buffer, pagesize=letter)
|
||||
width, height = letter
|
||||
# Add some text content so OCR and other tools can process it
|
||||
c.drawString(100, height - 100, "This is a test PDF document")
|
||||
c.showPage()
|
||||
c.save()
|
||||
|
||||
with open(context.file_name, "wb") as f:
|
||||
writer.write(f)
|
||||
f.write(buffer.getvalue())
|
||||
|
||||
if not hasattr(context, "files"):
|
||||
context.files = {}
|
||||
context.files[context.param_name] = open(context.file_name, "rb")
|
||||
@@ -52,11 +60,16 @@ def step_use_example_file(context, filePath, fileInput):
|
||||
|
||||
@given("the pdf contains {page_count:d} pages")
|
||||
def step_pdf_contains_pages(context, page_count):
|
||||
writer = PdfWriter()
|
||||
buffer = io.BytesIO()
|
||||
c = canvas.Canvas(buffer, pagesize=letter)
|
||||
width, height = letter
|
||||
for i in range(page_count):
|
||||
writer.add_blank_page(width=72, height=72)
|
||||
c.drawString(100, height - 100, f"Page {i + 1} of {page_count}")
|
||||
c.showPage()
|
||||
c.save()
|
||||
|
||||
with open(context.file_name, "wb") as f:
|
||||
writer.write(f)
|
||||
f.write(buffer.getvalue())
|
||||
context.files[context.param_name].close()
|
||||
context.files[context.param_name] = open(context.file_name, "rb")
|
||||
|
||||
@@ -64,11 +77,15 @@ def step_pdf_contains_pages(context, page_count):
|
||||
# Duplicate for now...
|
||||
@given("the pdf contains {page_count:d} blank pages")
|
||||
def step_pdf_contains_blank_pages(context, page_count):
|
||||
writer = PdfWriter()
|
||||
buffer = io.BytesIO()
|
||||
c = canvas.Canvas(buffer, pagesize=letter)
|
||||
width, height = letter
|
||||
for i in range(page_count):
|
||||
writer.add_blank_page(width=72, height=72)
|
||||
c.showPage()
|
||||
c.save()
|
||||
|
||||
with open(context.file_name, "wb") as f:
|
||||
writer.write(f)
|
||||
f.write(buffer.getvalue())
|
||||
context.files[context.param_name].close()
|
||||
context.files[context.param_name] = open(context.file_name, "rb")
|
||||
|
||||
|
||||
+8
-2
@@ -105,10 +105,13 @@ capture_file_list() {
|
||||
-not -path '*/tmp/stirling-pdf/PDFBox*' \
|
||||
-not -path '*/tmp/stirling-pdf/hsperfdata_stirlingpdfuser/*' \
|
||||
-not -path '*/tmp/hsperfdata_stirlingpdfuser/*' \
|
||||
-not -path '*/tmp/hsperfdata_root/*' \
|
||||
-not -path '*/tmp/stirling-pdf/jetty-*/*' \
|
||||
-not -path '*/tmp/stirling-pdf/lu*' \
|
||||
-not -path '*/tmp/stirling-pdf/tmp*' \
|
||||
-not -path '*/tmp/stirling-pdf/stirling-pdf-*.pdf' \
|
||||
-not -path '/app/stirling.aot' \
|
||||
-not -path '*/tmp/stirling.aotconf' \
|
||||
-not -path '*/tmp/aot-*.log' \
|
||||
2>/dev/null | xargs -I{} sh -c 'stat -c \"%n %s %Y\" \"{}\" 2>/dev/null || true' | sort" > "$output_file"
|
||||
|
||||
# Check if the output file has content
|
||||
@@ -128,11 +131,14 @@ capture_file_list() {
|
||||
-not -path '*/home/stirlingpdfuser/.pdfbox.cache' \
|
||||
-not -path '*/tmp/PDFBox*' \
|
||||
-not -path '*/tmp/hsperfdata_stirlingpdfuser/*' \
|
||||
-not -path '*/tmp/hsperfdata_root/*' \
|
||||
-not -path '*/tmp/stirling-pdf/hsperfdata_stirlingpdfuser/*' \
|
||||
-not -path '*/tmp/stirling-pdf/jetty-*/*' \
|
||||
-not -path '*/tmp/lu*' \
|
||||
-not -path '*/tmp/tmp*' \
|
||||
-not -path '*/tmp/stirling-pdf/stirling-pdf-*.pdf' \
|
||||
-not -path '/app/stirling.aot' \
|
||||
-not -path '*/tmp/stirling.aotconf' \
|
||||
-not -path '*/tmp/aot-*.log' \
|
||||
2>/dev/null | sort" > "$output_file"
|
||||
|
||||
if [ ! -s "$output_file" ]; then
|
||||
|
||||
+3
-3
@@ -57,17 +57,17 @@ build_and_test() {
|
||||
|
||||
case "$build_type" in
|
||||
full)
|
||||
dockerfile_name="./docker/backend/Dockerfile"
|
||||
dockerfile_name="./docker/embedded/Dockerfile.fat"
|
||||
if [ "$enable_security" == "true" ]; then
|
||||
compose_file="${docker_compose_base}-fat-security${compose_suffix}"
|
||||
service_name="Stirling-PDF-Security-Fat"
|
||||
else
|
||||
compose_file="${docker_compose_base}-fat${compose_suffix}"
|
||||
service_name="stirling-pdf-backend-fat"
|
||||
service_name="stirling-pdf-fat"
|
||||
fi
|
||||
;;
|
||||
ultra-lite)
|
||||
dockerfile_name="./docker/backend/Dockerfile.ultra-lite"
|
||||
dockerfile_name="./docker/embedded/Dockerfile.ultra-lite"
|
||||
if [ "$enable_security" == "true" ]; then
|
||||
compose_file="${docker_compose_base}-ultra-lite-security${compose_suffix}"
|
||||
service_name="stirling-pdf-backend-ultra-lite-security"
|
||||
|
||||
Reference in New Issue
Block a user