diff --git a/.github/workflows/push-docker.yml b/.github/workflows/push-docker.yml index 8bcf7803..e4509f98 100644 --- a/.github/workflows/push-docker.yml +++ b/.github/workflows/push-docker.yml @@ -110,3 +110,29 @@ jobs: labels: ${{ steps.meta2.outputs.labels }} build-args: VERSION_TAG=${{ steps.versionNumber.outputs.versionNumber }} platforms: linux/amd64,linux/arm64/v8 + + + - name: Generate tags fat + id: meta3 + uses: docker/metadata-action@v5 + with: + images: | + ${{ secrets.DOCKER_HUB_USERNAME }}/s-pdf + ghcr.io/${{ steps.repoowner.outputs.lowercase }}/s-pdf + tags: | + type=raw,value=${{ steps.versionNumber.outputs.versionNumber }}-fat,enable=${{ github.ref == 'refs/heads/master' }} + type=raw,value=latest-fat,enable=${{ github.ref == 'refs/heads/master' }} + + - name: Build and push main Dockerfile fat + uses: docker/build-push-action@v5 + with: + builder: ${{ steps.buildx.outputs.name }} + context: . + file: ./Dockerfile + push: true + cache-from: type=gha + cache-to: type=gha,mode=max + tags: ${{ steps.meta3.outputs.tags }} + labels: ${{ steps.meta3.outputs.labels }} + build-args: VERSION_TAG=${{ steps.versionNumber.outputs.versionNumber }} + platforms: linux/amd64,linux/arm64/v8 \ No newline at end of file diff --git a/exampleYmlFiles/docker-compose-latest-fat-security.yml b/exampleYmlFiles/docker-compose-latest-fat-security.yml new file mode 100644 index 00000000..a581fa9b --- /dev/null +++ b/exampleYmlFiles/docker-compose-latest-fat-security.yml @@ -0,0 +1,34 @@ +version: '3.3' +services: + stirling-pdf: + container_name: Stirling-PDF-Security-Fat + image: frooodle/s-pdf:latest-fat + deploy: + resources: + limits: + memory: 4G + healthcheck: + test: ["CMD-SHELL", "curl -f http://localhost:8080/api/v1/info/status | grep -q 'UP' && curl -fL http://localhost:8080/ | grep -q 'Please sign in'"] + interval: 5s + timeout: 10s + retries: 16 + ports: + - 8080:8080 + volumes: + - /stirling/latest/data:/usr/share/tessdata:rw + - /stirling/latest/config:/configs:rw + - /stirling/latest/logs:/logs:rw + environment: + DOCKER_ENABLE_SECURITY: "true" + SECURITY_ENABLELOGIN: "true" + PUID: 1002 + PGID: 1002 + UMASK: "022" + SYSTEM_DEFAULTLOCALE: en-US + UI_APPNAME: Stirling-PDF + UI_HOMEDESCRIPTION: Demo site for Stirling-PDF Latest-fat with Security + UI_APPNAMENAVBAR: Stirling-PDF Latest-fat + SYSTEM_MAXFILESIZE: "100" + METRICS_ENABLED: "true" + SYSTEM_GOOGLEVISIBILITY: "true" + restart: on-failure:5 diff --git a/src/main/java/stirling/software/SPDF/config/AppConfig.java b/src/main/java/stirling/software/SPDF/config/AppConfig.java index 3723e4f8..e71b01cd 100644 --- a/src/main/java/stirling/software/SPDF/config/AppConfig.java +++ b/src/main/java/stirling/software/SPDF/config/AppConfig.java @@ -125,9 +125,7 @@ public class AppConfig { public Predicate processPDFOnlyFilter() { return path -> { if (Files.isDirectory(path)) { - return !path.toString() - .contains( - "processing"); + return !path.toString().contains("processing"); } else { String fileName = path.getFileName().toString(); return fileName.endsWith(".pdf"); diff --git a/src/main/java/stirling/software/SPDF/controller/api/pipeline/PipelineDirectoryProcessor.java b/src/main/java/stirling/software/SPDF/controller/api/pipeline/PipelineDirectoryProcessor.java index ce7e1b94..25531880 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/pipeline/PipelineDirectoryProcessor.java +++ b/src/main/java/stirling/software/SPDF/controller/api/pipeline/PipelineDirectoryProcessor.java @@ -139,7 +139,11 @@ public class PipelineDirectoryProcessor { throws IOException { try (Stream paths = Files.list(dir)) { if ("automated".equals(operation.getParameters().get("fileInput"))) { - return paths.filter(path -> !Files.isDirectory(path) && !path.equals(jsonFile) && fileMonitor.isFileReadyForProcessing(path)) + return paths.filter( + path -> + !Files.isDirectory(path) + && !path.equals(jsonFile) + && fileMonitor.isFileReadyForProcessing(path)) .map(Path::toFile) .toArray(File[]::new); } else { diff --git a/src/main/java/stirling/software/SPDF/utils/FileMonitor.java b/src/main/java/stirling/software/SPDF/utils/FileMonitor.java index c11352ef..6d96958c 100644 --- a/src/main/java/stirling/software/SPDF/utils/FileMonitor.java +++ b/src/main/java/stirling/software/SPDF/utils/FileMonitor.java @@ -29,7 +29,8 @@ public class FileMonitor { /** * @param rootDirectory the root directory to monitor - * @param pathFilter the filter to apply to the paths, return true if the path should be monitored, false otherwise + * @param pathFilter the filter to apply to the paths, return true if the path should be + * monitored, false otherwise */ @Autowired public FileMonitor( diff --git a/src/main/resources/templates/fragments/navbar.html b/src/main/resources/templates/fragments/navbar.html index 9d15379f..7e72f2cd 100644 --- a/src/main/resources/templates/fragments/navbar.html +++ b/src/main/resources/templates/fragments/navbar.html @@ -90,6 +90,9 @@
+
+
@@ -118,6 +121,9 @@
+
+
diff --git a/test.sh b/test.sh index b5a49169..54c3c883 100644 --- a/test.sh +++ b/test.sh @@ -75,7 +75,6 @@ main() { # Building Docker images docker build --no-cache --build-arg VERSION_TAG=alpha -t frooodle/s-pdf:latest -f ./Dockerfile . docker build --no-cache --build-arg VERSION_TAG=alpha -t frooodle/s-pdf:latest-ultra-lite -f ./Dockerfile-ultra-lite . - docker build --no-cache --build-arg VERSION_TAG=alpha -t frooodle/s-pdf:latest-fat -f ./Dockerfile-fat . # Test each configuration run_tests "Stirling-PDF-Ultra-Lite" "./exampleYmlFiles/docker-compose-latest-ultra-lite.yml" @@ -105,13 +104,18 @@ main() { # Building Docker images with security enabled docker build --no-cache --build-arg VERSION_TAG=alpha -t frooodle/s-pdf:latest -f ./Dockerfile . docker build --no-cache --build-arg VERSION_TAG=alpha -t frooodle/s-pdf:latest-ultra-lite -f ./Dockerfile-ultra-lite . - + docker build --no-cache --build-arg VERSION_TAG=alpha -t frooodle/s-pdf:latest-fat -f ./Dockerfile-fat . + + # Test each configuration with security run_tests "Stirling-PDF-Ultra-Lite-Security" "./exampleYmlFiles/docker-compose-latest-ultra-lite-security.yml" docker-compose -f "./exampleYmlFiles/docker-compose-latest-ultra-lite-security.yml" down run_tests "Stirling-PDF-Security" "./exampleYmlFiles/docker-compose-latest-security.yml" docker-compose -f "./exampleYmlFiles/docker-compose-latest-security.yml" down - + + run_tests "Stirling-PDF-Security-Fat" "./exampleYmlFiles/docker-compose-latest-fat-security.yml" + docker-compose -f "./exampleYmlFiles/docker-compose-latest-fat-security.yml" down + # Report results echo "All tests completed in $SECONDS seconds."