Skip to content

Commit ab6a09a

Browse files
committed
Added extra sanity check + better output in case of failure
1 parent 37b7cff commit ab6a09a

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

Dockerfile-debian.template

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ RUN set -ex; \
3939
\
4040
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
4141
rm -rf /var/lib/apt/lists/*; \
42-
ldd "$extdir"/*.so | grep -qzv "=> not found";
42+
ldd "$extdir"/*.so | grep -qzv "=> not found" || (echo "Sanity check failed: missing libraries:"; ldd "$extdir"/*.so | grep " => not found"; exit 1); \
43+
ldd "$extdir"/*.so | grep -q "libzip.so.* => .*/libzip.so.*" || (echo "Sanity check failed: libzip.so is not referenced"; ldd "$extdir"/*.so; exit 1);
4344

4445
# set recommended PHP.ini settings
4546
# see https://secure.php.net/manual/en/opcache.installation.php

apache/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ RUN set -ex; \
3030
extdir="$(php -r 'echo ini_get("extension_dir");')"; \
3131
ldd "$extdir"/*.so \
3232
| awk '/=>/ { print $3 }' \
33+
| awk '{print $1} {system("realpath " $1)}' \
3334
| sort -u \
3435
| xargs -r dpkg-query -S \
3536
| cut -d: -f1 \
@@ -38,7 +39,8 @@ RUN set -ex; \
3839
\
3940
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
4041
rm -rf /var/lib/apt/lists/*; \
41-
ldd "$extdir"/*.so | grep -qzv "=> not found";
42+
ldd "$extdir"/*.so | grep -qzv "=> not found" || (echo "Sanity check failed: missing libraries:"; ldd "$extdir"/*.so | grep " => not found"; exit 1); \
43+
ldd "$extdir"/*.so | grep -q "libzip.so.* => .*/libzip.so.*" || (echo "Sanity check failed: libzip.so is not referenced"; ldd "$extdir"/*.so; exit 1);
4244

4345
# set recommended PHP.ini settings
4446
# see https://secure.php.net/manual/en/opcache.installation.php

fpm/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ RUN set -ex; \
3030
extdir="$(php -r 'echo ini_get("extension_dir");')"; \
3131
ldd "$extdir"/*.so \
3232
| awk '/=>/ { print $3 }' \
33+
| awk '{print $1} {system("realpath " $1)}' \
3334
| sort -u \
3435
| xargs -r dpkg-query -S \
3536
| cut -d: -f1 \
@@ -38,7 +39,8 @@ RUN set -ex; \
3839
\
3940
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
4041
rm -rf /var/lib/apt/lists/*; \
41-
ldd "$extdir"/*.so | grep -qzv "=> not found";
42+
ldd "$extdir"/*.so | grep -qzv "=> not found" || (echo "Sanity check failed: missing libraries:"; ldd "$extdir"/*.so | grep " => not found"; exit 1); \
43+
ldd "$extdir"/*.so | grep -q "libzip.so.* => .*/libzip.so.*" || (echo "Sanity check failed: libzip.so is not referenced"; ldd "$extdir"/*.so; exit 1);
4244

4345
# set recommended PHP.ini settings
4446
# see https://secure.php.net/manual/en/opcache.installation.php

0 commit comments

Comments
 (0)