Skip to content

Commit 30db079

Browse files
committed
Merge #418 - improve the fix made in #417
Ref: 87bbb8d
2 parents 692333a + da4b8f2 commit 30db079

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

Dockerfile-debian.template

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ RUN set -ex; \
3030
apt-mark manual $savedAptMark; \
3131
extdir="$(php -r 'echo ini_get("extension_dir");')"; \
3232
ldd "$extdir"/*.so \
33-
| awk '/=>/ { print $3 }' \
34-
| awk '{print $1} {system("realpath " $1)}' \
33+
| awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); print so }' \
3534
| sort -u \
3635
| xargs -r dpkg-query -S \
3736
| cut -d: -f1 \
@@ -41,7 +40,9 @@ RUN set -ex; \
4140
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
4241
rm -rf /var/lib/apt/lists/*; \
4342
ldd "$extdir"/*.so | grep -qzv "=> not found" || (echo "Sanity check failed: missing libraries:"; ldd "$extdir"/*.so | grep " => not found"; exit 1); \
44-
ldd "$extdir"/*.so | grep -q "libzip.so.* => .*/libzip.so.*" || (echo "Sanity check failed: libzip.so is not referenced"; ldd "$extdir"/*.so; 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); \
44+
err="$(php --version 3>&1 1>&2 2>&3)"; \
45+
[ -z "$err" ] || (echo "Sanity check failed: php returned errors; $err"; exit 1;);
4546

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

apache/Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ RUN set -ex; \
3131
apt-mark manual $savedAptMark; \
3232
extdir="$(php -r 'echo ini_get("extension_dir");')"; \
3333
ldd "$extdir"/*.so \
34-
| awk '/=>/ { print $3 }' \
35-
| awk '{print $1} {system("realpath " $1)}' \
34+
| awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); print so }' \
3635
| sort -u \
3736
| xargs -r dpkg-query -S \
3837
| cut -d: -f1 \
@@ -42,7 +41,9 @@ RUN set -ex; \
4241
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
4342
rm -rf /var/lib/apt/lists/*; \
4443
ldd "$extdir"/*.so | grep -qzv "=> not found" || (echo "Sanity check failed: missing libraries:"; ldd "$extdir"/*.so | grep " => not found"; exit 1); \
45-
ldd "$extdir"/*.so | grep -q "libzip.so.* => .*/libzip.so.*" || (echo "Sanity check failed: libzip.so is not referenced"; ldd "$extdir"/*.so; exit 1);
44+
ldd "$extdir"/*.so | grep -q "libzip.so.* => .*/libzip.so.*" || (echo "Sanity check failed: libzip.so is not referenced"; ldd "$extdir"/*.so; exit 1); \
45+
err="$(php --version 3>&1 1>&2 2>&3)"; \
46+
[ -z "$err" ] || (echo "Sanity check failed: php returned errors; $err"; exit 1;);
4647

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

fpm/Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ RUN set -ex; \
3131
apt-mark manual $savedAptMark; \
3232
extdir="$(php -r 'echo ini_get("extension_dir");')"; \
3333
ldd "$extdir"/*.so \
34-
| awk '/=>/ { print $3 }' \
35-
| awk '{print $1} {system("realpath " $1)}' \
34+
| awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); print so }' \
3635
| sort -u \
3736
| xargs -r dpkg-query -S \
3837
| cut -d: -f1 \
@@ -42,7 +41,9 @@ RUN set -ex; \
4241
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
4342
rm -rf /var/lib/apt/lists/*; \
4443
ldd "$extdir"/*.so | grep -qzv "=> not found" || (echo "Sanity check failed: missing libraries:"; ldd "$extdir"/*.so | grep " => not found"; exit 1); \
45-
ldd "$extdir"/*.so | grep -q "libzip.so.* => .*/libzip.so.*" || (echo "Sanity check failed: libzip.so is not referenced"; ldd "$extdir"/*.so; exit 1);
44+
ldd "$extdir"/*.so | grep -q "libzip.so.* => .*/libzip.so.*" || (echo "Sanity check failed: libzip.so is not referenced"; ldd "$extdir"/*.so; exit 1); \
45+
err="$(php --version 3>&1 1>&2 2>&3)"; \
46+
[ -z "$err" ] || (echo "Sanity check failed: php returned errors; $err"; exit 1;);
4647

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

0 commit comments

Comments
 (0)