Skip to content

Commit

Permalink
Merge pull request #49 from lufei/fix/deps
Browse files Browse the repository at this point in the history
Fix debian 12 issue that causes extension libraries to be uninstalled
  • Loading branch information
joyqi authored Oct 16, 2024
2 parents 98e5343 + 7c5c314 commit 88ba0ee
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 63 deletions.
84 changes: 42 additions & 42 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 }}
Expand All @@ -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:
Expand All @@ -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 }}
Expand All @@ -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:
Expand All @@ -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 }}
Expand All @@ -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:
Expand All @@ -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 }}
Expand All @@ -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:
Expand All @@ -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 }}
Expand All @@ -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:
Expand All @@ -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 }}
Expand All @@ -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:
Expand All @@ -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 }}
Expand All @@ -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:
Expand All @@ -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 }}
Expand All @@ -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:
Expand All @@ -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 }}
Expand All @@ -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:
Expand All @@ -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 }}
Expand All @@ -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:
Expand All @@ -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 }}
Expand All @@ -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:
Expand All @@ -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 }}
Expand All @@ -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:
Expand All @@ -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 }}
Expand All @@ -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:
Expand All @@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.apache
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
2 changes: 1 addition & 1 deletion Dockerfile.cli
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

CMD init_typecho cli
CMD ["init_typecho", "cli"]
2 changes: 1 addition & 1 deletion Dockerfile.default
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

EXPOSE 80

CMD init_typecho
CMD ["init_typecho"]
2 changes: 1 addition & 1 deletion Dockerfile.fpm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# expose fcgi port
EXPOSE 9000

CMD init_typecho fpm
CMD ["init_typecho", "fpm"]
6 changes: 3 additions & 3 deletions make-workflows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 }}
Expand Down
32 changes: 18 additions & 14 deletions scripts/after.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 88ba0ee

Please sign in to comment.