From dd7087145cbd1a700af83fa65f754609a22b7a5e Mon Sep 17 00:00:00 2001 From: M-arcus <25648755+M-arcus@users.noreply.github.com> Date: Fri, 15 Mar 2024 16:31:03 +0100 Subject: [PATCH] Adjust for fink --- .github/workflows/build.yml | 20 ++++++++++---------- Dockerfile | 16 ++++++++-------- README.md | 14 +++++++++----- build-base.sh | 10 +++++----- wolfi-base.yaml | 2 -- 5 files changed, 32 insertions(+), 30 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e4672e8..c178c4e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,16 +30,16 @@ jobs: - name: Build base and push run: ./build-base.sh - phpmd: + fink: needs: [base] runs-on: ubuntu-latest steps: - name: Get latest PHP Mess Detector version - id: phpmd_version + id: fink_version run: | - VERSION=$(curl https://api.github.com/repos/phpmd/phpmd/releases/latest | jq '.tag_name | ltrimstr("v")' -r) - echo "PHPMD_VERSION=${VERSION}" >> "$GITHUB_OUTPUT" - echo "PHPMD_VERSION=${VERSION}" >> "$GITHUB_ENV" + VERSION=$(curl https://api.github.com/repos/dantleech/fink/releases/latest | jq '.tag_name | ltrimstr("v")' -r) + echo "FINK_VERSION=${VERSION}" >> "$GITHUB_OUTPUT" + echo "FINK_VERSION=${VERSION}" >> "$GITHUB_ENV" - name: Login into Github Docker Registry run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin @@ -56,9 +56,9 @@ jobs: push: true platforms: linux/amd64,linux/arm64 build-args: | - PHP_PHPMD_VERSION=${{ steps.phpmd_version.outputs.PHPMD_VERSION }} + PHP_FINK_VERSION=${{ steps.fink_version.outputs.FINK_VERSION }} tags: | - marcusmu/php-mess-detector:latest - marcusmu/php-mess-detector:${{ steps.phpmd_version.outputs.PHPMD_VERSION }} - ghcr.io/m-arcus/php-mess-detector:latest - ghcr.io/m-arcus/php-mess-detector:${{ steps.phpmd_version.outputs.PHPMD_VERSION }} + marcusmu/php-fink:latest + marcusmu/php-fink:${{ steps.fink_version.outputs.FINK_VERSION }} + ghcr.io/m-arcus/php-fink:latest + ghcr.io/m-arcus/php-fink:${{ steps.fink_version.outputs.FINK_VERSION }} diff --git a/Dockerfile b/Dockerfile index 01c37b8..4f62328 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,15 @@ -FROM ghcr.io/m-arcus/php-mess-detector:base +FROM ghcr.io/m-arcus/php-fink:base -ARG PHP_PHPMD_VERSION=2.15.0 +ARG PHP_PHPMD_VERSION=0.10.3 LABEL org.opencontainers.image.authors="M-arcus" \ - org.opencontainers.image.url="https://github.com/phpmd/phpmd/" \ - org.opencontainers.image.documentation="https://phpmd.org/documentation/index.html" \ - org.opencontainers.image.source="https://github.com/M-arcus/php-mess-detector-docker" \ + org.opencontainers.image.url="https://github.com/dantleech/fink/" \ + org.opencontainers.image.documentation="https://github.com/dantleech/fink/blob/master/README.md" \ + org.opencontainers.image.source="https://github.com/M-arcus/php-fink-docker" \ org.opencontainers.image.vendor="M-arcus" \ org.opencontainers.image.licenses="MIT" \ - org.opencontainers.image.title="PHP Mess Detector" + org.opencontainers.image.title="Fink" -ADD https://github.com/phpmd/phpmd/releases/download/${PHP_PHPMD_VERSION}/phpmd.phar /phpmd.phar +ADD https://github.com/dantleech/fink/releases/download/${PHP_PHPMD_VERSION}/fink.phar /fink.phar -ENTRYPOINT ["/usr/bin/php", "/phpmd.phar"] +ENTRYPOINT ["/usr/bin/php", "/fink.phar"] diff --git a/README.md b/README.md index 5a1f814..cc81f95 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,16 @@ -# Small PHP-Mess-Detector Docker image +# Small Fink Docker image -This image uses Wolfi-OS to create a very small PHPMD Docker image and still glibc, to be used in CI/CD pipelines. +This image uses Wolfi-OS to create a very small [Fink](https://github.com/dantleech/fink) Docker image and still glibc, to be used in CI/CD pipelines. ## Usage ```bash -# or alternative use ghcr.io/m-arcus/php-mess-detector:latest -docker run --rm -v $(pwd):$(pwd) -w $(pwd) marcusmu/php-mess-detector:latest /path/to/source text codesize +# or alternative use ghcr.io/m-arcus/php-fink:latest +docker run --rm -v $(pwd):$(pwd) -w $(pwd) marcusmu/php-fink:latest https://my.website.com/ --output=result.json --exclude-url=Account --insecure ``` -If you don't want to pass the as arguments, you can create your regular `phpmd.xml` (and `phpmd.baseline.xml` and `.phpmd.result-cache.php` (`--cache`)) file and PHP Mess Detector will pick it up as usual. +If you want to scan for broken links in a website, you can use the following command: + +```bash +cat result.json | jq -c '. | select(.status!=200) | {status: .status, url: .url, referrer: .referrer}' | jq +``` diff --git a/build-base.sh b/build-base.sh index bdf1102..845cac9 100755 --- a/build-base.sh +++ b/build-base.sh @@ -8,15 +8,15 @@ docker run \ -w /work \ cgr.dev/chainguard/apko \ build \ - wolfi-base.yaml ghcr.io/m-arcus/php-mess-detector:base base.tar + wolfi-base.yaml ghcr.io/m-arcus/php-fink:base base.tar docker load < base.tar rm -f base.tar sbom* -docker push ghcr.io/m-arcus/php-mess-detector:base-amd64 -docker push ghcr.io/m-arcus/php-mess-detector:base-arm64 +docker push ghcr.io/m-arcus/php-fink:base-amd64 +docker push ghcr.io/m-arcus/php-fink:base-arm64 -docker manifest create ghcr.io/m-arcus/php-mess-detector:base --amend ghcr.io/m-arcus/php-mess-detector:base-amd64 --amend ghcr.io/m-arcus/php-mess-detector:base-arm64 +docker manifest create ghcr.io/m-arcus/php-fink:base --amend ghcr.io/m-arcus/php-fink:base-amd64 --amend ghcr.io/m-arcus/php-fink:base-arm64 -docker manifest push ghcr.io/m-arcus/php-mess-detector:base \ No newline at end of file +docker manifest push ghcr.io/m-arcus/php-fink:base \ No newline at end of file diff --git a/wolfi-base.yaml b/wolfi-base.yaml index 50be6b1..f71f263 100644 --- a/wolfi-base.yaml +++ b/wolfi-base.yaml @@ -6,8 +6,6 @@ contents: packages: - wolfi-base - php-8.2 - - php-8.2-dom - - php-8.2-mbstring - php-8.2-phar - php-8.2-simplexml - php-8.2-xml