From 7c5c31462d75de959e0d44cf3c345cf6837270db Mon Sep 17 00:00:00 2001 From: sy-records <52o@qq52o.cn> Date: Fri, 11 Oct 2024 17:55:50 +0800 Subject: [PATCH] fix missing deps --- .github/workflows/build.yml | 84 ++++++++++++++++++------------------- Dockerfile.apache | 2 +- Dockerfile.cli | 2 +- Dockerfile.default | 2 +- Dockerfile.fpm | 2 +- make-workflows.sh | 6 +-- scripts/after.sh | 32 +++++++------- 7 files changed, 67 insertions(+), 63 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 55396d6..413b4ca 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,9 +16,9 @@ jobs: - name: Checkout the repo uses: actions/checkout@v4 - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Login to DockerHub uses: docker/login-action@v3 with: @@ -31,7 +31,7 @@ jobs: env: dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }} - name: Build and push - uses: docker/build-push-action@v4 + uses: docker/build-push-action@v6 with: context: . platforms: ${{ steps.generate.outputs.PLATFORM }} @@ -52,9 +52,9 @@ jobs: - name: Checkout the repo uses: actions/checkout@v4 - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Login to DockerHub uses: docker/login-action@v3 with: @@ -67,7 +67,7 @@ jobs: env: dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }} - name: Build and push - uses: docker/build-push-action@v4 + uses: docker/build-push-action@v6 with: context: . platforms: ${{ steps.generate.outputs.PLATFORM }} @@ -88,9 +88,9 @@ jobs: - name: Checkout the repo uses: actions/checkout@v4 - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Login to DockerHub uses: docker/login-action@v3 with: @@ -103,7 +103,7 @@ jobs: env: dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }} - name: Build and push - uses: docker/build-push-action@v4 + uses: docker/build-push-action@v6 with: context: . platforms: ${{ steps.generate.outputs.PLATFORM }} @@ -124,9 +124,9 @@ jobs: - name: Checkout the repo uses: actions/checkout@v4 - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Login to DockerHub uses: docker/login-action@v3 with: @@ -139,7 +139,7 @@ jobs: env: dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }} - name: Build and push - uses: docker/build-push-action@v4 + uses: docker/build-push-action@v6 with: context: . platforms: ${{ steps.generate.outputs.PLATFORM }} @@ -159,9 +159,9 @@ jobs: - name: Checkout the repo uses: actions/checkout@v4 - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Login to DockerHub uses: docker/login-action@v3 with: @@ -174,7 +174,7 @@ jobs: env: dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }} - name: Build and push - uses: docker/build-push-action@v4 + uses: docker/build-push-action@v6 with: context: . platforms: ${{ steps.generate.outputs.PLATFORM }} @@ -195,9 +195,9 @@ jobs: - name: Checkout the repo uses: actions/checkout@v4 - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Login to DockerHub uses: docker/login-action@v3 with: @@ -210,7 +210,7 @@ jobs: env: dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }} - name: Build and push - uses: docker/build-push-action@v4 + uses: docker/build-push-action@v6 with: context: . platforms: ${{ steps.generate.outputs.PLATFORM }} @@ -231,9 +231,9 @@ jobs: - name: Checkout the repo uses: actions/checkout@v4 - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Login to DockerHub uses: docker/login-action@v3 with: @@ -246,7 +246,7 @@ jobs: env: dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }} - name: Build and push - uses: docker/build-push-action@v4 + uses: docker/build-push-action@v6 with: context: . platforms: ${{ steps.generate.outputs.PLATFORM }} @@ -267,9 +267,9 @@ jobs: - name: Checkout the repo uses: actions/checkout@v4 - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Login to DockerHub uses: docker/login-action@v3 with: @@ -282,7 +282,7 @@ jobs: env: dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }} - name: Build and push - uses: docker/build-push-action@v4 + uses: docker/build-push-action@v6 with: context: . platforms: ${{ steps.generate.outputs.PLATFORM }} @@ -302,9 +302,9 @@ jobs: - name: Checkout the repo uses: actions/checkout@v4 - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Login to DockerHub uses: docker/login-action@v3 with: @@ -317,7 +317,7 @@ jobs: env: dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }} - name: Build and push - uses: docker/build-push-action@v4 + uses: docker/build-push-action@v6 with: context: . platforms: ${{ steps.generate.outputs.PLATFORM }} @@ -338,9 +338,9 @@ jobs: - name: Checkout the repo uses: actions/checkout@v4 - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Login to DockerHub uses: docker/login-action@v3 with: @@ -353,7 +353,7 @@ jobs: env: dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }} - name: Build and push - uses: docker/build-push-action@v4 + uses: docker/build-push-action@v6 with: context: . platforms: ${{ steps.generate.outputs.PLATFORM }} @@ -374,9 +374,9 @@ jobs: - name: Checkout the repo uses: actions/checkout@v4 - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Login to DockerHub uses: docker/login-action@v3 with: @@ -389,7 +389,7 @@ jobs: env: dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }} - name: Build and push - uses: docker/build-push-action@v4 + uses: docker/build-push-action@v6 with: context: . platforms: ${{ steps.generate.outputs.PLATFORM }} @@ -409,9 +409,9 @@ jobs: - name: Checkout the repo uses: actions/checkout@v4 - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Login to DockerHub uses: docker/login-action@v3 with: @@ -424,7 +424,7 @@ jobs: env: dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }} - name: Build and push - uses: docker/build-push-action@v4 + uses: docker/build-push-action@v6 with: context: . platforms: ${{ steps.generate.outputs.PLATFORM }} @@ -445,9 +445,9 @@ jobs: - name: Checkout the repo uses: actions/checkout@v4 - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Login to DockerHub uses: docker/login-action@v3 with: @@ -460,7 +460,7 @@ jobs: env: dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }} - name: Build and push - uses: docker/build-push-action@v4 + uses: docker/build-push-action@v6 with: context: . platforms: ${{ steps.generate.outputs.PLATFORM }} @@ -481,9 +481,9 @@ jobs: - name: Checkout the repo uses: actions/checkout@v4 - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Login to DockerHub uses: docker/login-action@v3 with: @@ -496,7 +496,7 @@ jobs: env: dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }} - name: Build and push - uses: docker/build-push-action@v4 + uses: docker/build-push-action@v6 with: context: . platforms: ${{ steps.generate.outputs.PLATFORM }} diff --git a/Dockerfile.apache b/Dockerfile.apache index fc511f2..0cca23e 100644 --- a/Dockerfile.apache +++ b/Dockerfile.apache @@ -15,4 +15,4 @@ RUN sed -ri -e 's!/var/www/!/app!g' /etc/apache2/apache2.conf /etc/apache2/conf- # expose http EXPOSE 80 -CMD init_typecho apache +CMD ["init_typecho", "apache"] diff --git a/Dockerfile.cli b/Dockerfile.cli index 322a7e2..067d8bf 100644 --- a/Dockerfile.cli +++ b/Dockerfile.cli @@ -1,2 +1,2 @@ -CMD init_typecho cli +CMD ["init_typecho", "cli"] diff --git a/Dockerfile.default b/Dockerfile.default index fcb2e09..fd91088 100644 --- a/Dockerfile.default +++ b/Dockerfile.default @@ -1,4 +1,4 @@ EXPOSE 80 -CMD init_typecho \ No newline at end of file +CMD ["init_typecho"] diff --git a/Dockerfile.fpm b/Dockerfile.fpm index 806f883..48bbba4 100644 --- a/Dockerfile.fpm +++ b/Dockerfile.fpm @@ -1,4 +1,4 @@ # expose fcgi port EXPOSE 9000 -CMD init_typecho fpm +CMD ["init_typecho", "fpm"] diff --git a/make-workflows.sh b/make-workflows.sh index e601856..08d24e9 100755 --- a/make-workflows.sh +++ b/make-workflows.sh @@ -50,9 +50,9 @@ ${needs} - name: Checkout the repo uses: actions/checkout@v4 - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Login to DockerHub uses: docker/login-action@v3 with: @@ -65,7 +65,7 @@ ${needs} env: dockerhub_username: \${{ secrets.DOCKERHUB_USERNAME }} - name: Build and push - uses: docker/build-push-action@v4 + uses: docker/build-push-action@v6 with: context: . platforms: \${{ steps.generate.outputs.PLATFORM }} diff --git a/scripts/after.sh b/scripts/after.sh index 2749070..295ec2c 100755 --- a/scripts/after.sh +++ b/scripts/after.sh @@ -2,26 +2,30 @@ if [ "$(use 'y' 'n')" = "n" ]; then runDeps=$( - scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \ - | tr ',' '\n' \ - | sort -u \ - | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' - ) + scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \ + | tr ',' '\n' \ + | sort -u \ + | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' + ) apk add --no-network --virtual .typecho-phpexts-rundeps $runDeps; apk del --no-network .build-deps else savedAptMark=$1 apt-mark auto '.*' > /dev/null - apt-mark manual $savedAptMark - ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \ - | awk '/=>/ { print $3 }' \ - | sort -u \ - | xargs -r dpkg-query -S \ - | cut -d: -f1 \ - | sort -u \ - | xargs -rt apt-mark manual + apt-mark manual $savedAptMark + extdir="$(php -r 'echo ini_get("extension_dir");')"; \ + ldd "$extdir"/*.so \ + | awk '/=>/ { print $3 }' \ + | awk '{print $1} {system("realpath " $1)}' \ + | sort -u \ + | xargs -r dpkg-query -S \ + | cut -d: -f1 \ + | sort -u \ + | xargs -rt apt-mark manual apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false - rm -rf /var/lib/apt/lists/* + rm -rf /var/lib/apt/lists/*; + ldd "$extdir"/*.so | grep -qzv "=> not found" || (echo "Sanity check failed: missing libraries:"; ldd "$extdir"/*.so | grep " => not found"; exit 1); \ + ldd "$extdir"/*.so | grep -q "libzip.so.* => .*/libzip.so.*" || (echo "Sanity check failed: libzip.so is not referenced"; ldd "$extdir"/*.so; exit 1); fi