Skip to content

Conversation

@williamdes
Copy link
Contributor

@github-actions

This comment has been minimized.

@tianon
Copy link
Member

tianon commented Jul 3, 2023

+        | awk '{print $1} {system("realpath " $1)}' \

Doing realpath for the dpkg-query bug isn't entirely correct, and there are pathological cases where it might not actually work correctly. 🙈

What I'd suggest instead is what I proposed in docker-library/python#822 (comment) (and what we used in the PHP image; https://github.com/docker-library/php/blob/0bae31aa4aa0afffdc394072bda779fa652f74fc/Dockerfile-linux.template#L425), which strips any possible /(usr/)? prefix so it's still matching the longest possible path:

		| awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); print so }' \

@tianon
Copy link
Member

tianon commented Jul 3, 2023

You might also enjoy https://github.com/docker-library/wordpress/blob/dd5c229a1900cab9543b180945b8a80754936eac/Dockerfile.template#L125-L128, but I feel a lot less strongly about that change - if you're happy with what you've got there, it's totally fine. 😄

@williamdes
Copy link
Contributor Author

Hi @ederuiter
Could you have a look about this feedbacks, let me know if you do not have time so I allocate some time to fix this on the docker repo :)

Thank you @tianon !

@ederuiter
Copy link

✅ I will have a look at it tomorrow
But with these levels of workarounds in other containers, I think this also should be addressed upstream somehow .. but so far no reaction on that issue: debuerreotype/docker-debian-artifacts#199

ederuiter added a commit to ederuiter/docker that referenced this pull request Jul 4, 2023
@github-actions

This comment has been minimized.

@github-actions
Copy link

github-actions bot commented Jul 4, 2023

Diff for c32e5b5:
diff --git a/_bashbrew-cat b/_bashbrew-cat
index 052f074..767f734 100644
--- a/_bashbrew-cat
+++ b/_bashbrew-cat
@@ -3,15 +3,15 @@ GitRepo: https://github.com/phpmyadmin/docker.git
 
 Tags: 5.2.1-apache, 5.2-apache, 5-apache, apache, 5.2.1, 5.2, 5, latest
 Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, mips64le, ppc64le, s390x
-GitCommit: 7f5a48b7c3ac2b820be1c0d4808f7277640a70b8
+GitCommit: da4b8f273a0a81078185076683ed92a382814ef3
 Directory: apache
 
 Tags: 5.2.1-fpm, 5.2-fpm, 5-fpm, fpm
 Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, mips64le, ppc64le, s390x
-GitCommit: 7f5a48b7c3ac2b820be1c0d4808f7277640a70b8
+GitCommit: da4b8f273a0a81078185076683ed92a382814ef3
 Directory: fpm
 
 Tags: 5.2.1-fpm-alpine, 5.2-fpm-alpine, 5-fpm-alpine, fpm-alpine
 Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, s390x
-GitCommit: 7f5a48b7c3ac2b820be1c0d4808f7277640a70b8
+GitCommit: 8674356a6d0f67eb89d0200647832fc3853781fd
 Directory: fpm-alpine
diff --git a/phpmyadmin_fpm-alpine/Dockerfile b/phpmyadmin_fpm-alpine/Dockerfile
index 129e0e7..60b095f 100644
--- a/phpmyadmin_fpm-alpine/Dockerfile
+++ b/phpmyadmin_fpm-alpine/Dockerfile
@@ -1,4 +1,5 @@
-FROM php:8.1-fpm-alpine
+# DO NOT EDIT: created by update.sh from Dockerfile-alpine.template
+FROM php:8.2-fpm-alpine
 
 # docker-entrypoint.sh dependencies
 RUN apk add --no-cache \
@@ -25,6 +26,7 @@ RUN set -ex; \
         mysqli \
         opcache \
         zip \
+        bcmath \
     ; \
     \
     runDeps="$( \
@@ -33,7 +35,7 @@ RUN set -ex; \
             | sort -u \
             | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
     )"; \
-    apk add --virtual .phpmyadmin-phpexts-rundeps $runDeps; \
+    apk add --no-network --virtual .phpmyadmin-phpexts-rundeps $runDeps; \
     apk del --no-network .build-deps
 
 # set recommended PHP.ini settings
@@ -42,6 +44,7 @@ ENV MAX_EXECUTION_TIME 600
 ENV MEMORY_LIMIT 512M
 ENV UPLOAD_LIMIT 2048K
 ENV TZ UTC
+ENV SESSION_SAVE_PATH /sessions
 RUN set -ex; \
     \
     { \
@@ -65,6 +68,7 @@ RUN set -ex; \
         echo 'post_max_size=${UPLOAD_LIMIT}'; \
         echo 'upload_max_filesize=${UPLOAD_LIMIT}'; \
         echo 'date.timezone=${TZ}'; \
+        echo 'session.save_path=${SESSION_SAVE_PATH}'; \
     } > $PHP_INI_DIR/conf.d/phpmyadmin-misc.ini
 
 # Calculate download URL
@@ -87,6 +91,9 @@ RUN set -ex; \
     apk add --no-cache --virtual .fetch-deps \
         gnupg \
     ; \
+    mkdir $SESSION_SAVE_PATH; \
+    chmod 1777 $SESSION_SAVE_PATH; \
+    chown www-data:www-data $SESSION_SAVE_PATH; \
     \
     export GNUPGHOME="$(mktemp -d)"; \
     export GPGKEY="3D06A59ECE730EB71B511C17CE752F178259BD92"; \
diff --git a/phpmyadmin_fpm-alpine/config.inc.php b/phpmyadmin_fpm-alpine/config.inc.php
index 8055e5c..9a39134 100644
--- a/phpmyadmin_fpm-alpine/config.inc.php
+++ b/phpmyadmin_fpm-alpine/config.inc.php
@@ -159,3 +159,10 @@ if (isset($_ENV['MEMORY_LIMIT'])) {
 if (file_exists('/etc/phpmyadmin/config.user.inc.php')) {
     include '/etc/phpmyadmin/config.user.inc.php';
 }
+
+/* Support additional configurations */
+if (is_dir('/etc/phpmyadmin/conf.d/')) {
+    foreach (glob('/etc/phpmyadmin/conf.d/*.php') as $filename) {
+        include $filename;
+    }
+}
diff --git a/phpmyadmin_fpm/Dockerfile b/phpmyadmin_fpm/Dockerfile
index f78c0ab..34e24d1 100644
--- a/phpmyadmin_fpm/Dockerfile
+++ b/phpmyadmin_fpm/Dockerfile
@@ -1,4 +1,5 @@
-FROM php:8.1-fpm
+# DO NOT EDIT: created by update.sh from Dockerfile-debian.template
+FROM php:8.2-fpm
 
 # Install dependencies
 RUN set -ex; \
@@ -23,12 +24,14 @@ RUN set -ex; \
         mysqli \
         opcache \
         zip \
+        bcmath \
     ; \
     \
     apt-mark auto '.*' > /dev/null; \
     apt-mark manual $savedAptMark; \
-    ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \
-        | awk '/=>/ { print $3 }' \
+    extdir="$(php -r 'echo ini_get("extension_dir");')"; \
+    ldd "$extdir"/*.so \
+        | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); print so }' \
         | sort -u \
         | xargs -r dpkg-query -S \
         | cut -d: -f1 \
@@ -36,7 +39,11 @@ RUN set -ex; \
         | 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); \
+    err="$(php --version 3>&1 1>&2 2>&3)"; \
+    [ -z "$err" ] || (echo "Sanity check failed: php returned errors; $err"; exit 1;);
 
 # set recommended PHP.ini settings
 # see https://secure.php.net/manual/en/opcache.installation.php
@@ -44,6 +51,7 @@ ENV MAX_EXECUTION_TIME 600
 ENV MEMORY_LIMIT 512M
 ENV UPLOAD_LIMIT 2048K
 ENV TZ UTC
+ENV SESSION_SAVE_PATH /sessions
 RUN set -ex; \
     \
     { \
@@ -67,6 +75,7 @@ RUN set -ex; \
         echo 'post_max_size=${UPLOAD_LIMIT}'; \
         echo 'upload_max_filesize=${UPLOAD_LIMIT}'; \
         echo 'date.timezone=${TZ}'; \
+        echo 'session.save_path=${SESSION_SAVE_PATH}'; \
     } > $PHP_INI_DIR/conf.d/phpmyadmin-misc.ini
 
 # Calculate download URL
@@ -94,6 +103,9 @@ RUN set -ex; \
         gnupg \
         dirmngr \
     ; \
+    mkdir $SESSION_SAVE_PATH; \
+    chmod 1777 $SESSION_SAVE_PATH; \
+    chown www-data:www-data $SESSION_SAVE_PATH; \
     \
     export GNUPGHOME="$(mktemp -d)"; \
     export GPGKEY="3D06A59ECE730EB71B511C17CE752F178259BD92"; \
diff --git a/phpmyadmin_fpm/config.inc.php b/phpmyadmin_fpm/config.inc.php
index 8055e5c..9a39134 100644
--- a/phpmyadmin_fpm/config.inc.php
+++ b/phpmyadmin_fpm/config.inc.php
@@ -159,3 +159,10 @@ if (isset($_ENV['MEMORY_LIMIT'])) {
 if (file_exists('/etc/phpmyadmin/config.user.inc.php')) {
     include '/etc/phpmyadmin/config.user.inc.php';
 }
+
+/* Support additional configurations */
+if (is_dir('/etc/phpmyadmin/conf.d/')) {
+    foreach (glob('/etc/phpmyadmin/conf.d/*.php') as $filename) {
+        include $filename;
+    }
+}
diff --git a/phpmyadmin_latest/Dockerfile b/phpmyadmin_latest/Dockerfile
index 8ba144b..66a9262 100644
--- a/phpmyadmin_latest/Dockerfile
+++ b/phpmyadmin_latest/Dockerfile
@@ -1,4 +1,5 @@
-FROM php:8.1-apache
+# DO NOT EDIT: created by update.sh from Dockerfile-debian.template
+FROM php:8.2-apache
 
 # Install dependencies
 RUN set -ex; \
@@ -23,12 +24,14 @@ RUN set -ex; \
         mysqli \
         opcache \
         zip \
+        bcmath \
     ; \
     \
     apt-mark auto '.*' > /dev/null; \
     apt-mark manual $savedAptMark; \
-    ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \
-        | awk '/=>/ { print $3 }' \
+    extdir="$(php -r 'echo ini_get("extension_dir");')"; \
+    ldd "$extdir"/*.so \
+        | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); print so }' \
         | sort -u \
         | xargs -r dpkg-query -S \
         | cut -d: -f1 \
@@ -36,7 +39,11 @@ RUN set -ex; \
         | 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); \
+    err="$(php --version 3>&1 1>&2 2>&3)"; \
+    [ -z "$err" ] || (echo "Sanity check failed: php returned errors; $err"; exit 1;);
 
 # set recommended PHP.ini settings
 # see https://secure.php.net/manual/en/opcache.installation.php
@@ -44,6 +51,7 @@ ENV MAX_EXECUTION_TIME 600
 ENV MEMORY_LIMIT 512M
 ENV UPLOAD_LIMIT 2048K
 ENV TZ UTC
+ENV SESSION_SAVE_PATH /sessions
 RUN set -ex; \
     \
     { \
@@ -67,6 +75,7 @@ RUN set -ex; \
         echo 'post_max_size=${UPLOAD_LIMIT}'; \
         echo 'upload_max_filesize=${UPLOAD_LIMIT}'; \
         echo 'date.timezone=${TZ}'; \
+        echo 'session.save_path=${SESSION_SAVE_PATH}'; \
     } > $PHP_INI_DIR/conf.d/phpmyadmin-misc.ini
 
 # Calculate download URL
@@ -94,6 +103,9 @@ RUN set -ex; \
         gnupg \
         dirmngr \
     ; \
+    mkdir $SESSION_SAVE_PATH; \
+    chmod 1777 $SESSION_SAVE_PATH; \
+    chown www-data:www-data $SESSION_SAVE_PATH; \
     \
     export GNUPGHOME="$(mktemp -d)"; \
     export GPGKEY="3D06A59ECE730EB71B511C17CE752F178259BD92"; \
diff --git a/phpmyadmin_latest/config.inc.php b/phpmyadmin_latest/config.inc.php
index 8055e5c..9a39134 100644
--- a/phpmyadmin_latest/config.inc.php
+++ b/phpmyadmin_latest/config.inc.php
@@ -159,3 +159,10 @@ if (isset($_ENV['MEMORY_LIMIT'])) {
 if (file_exists('/etc/phpmyadmin/config.user.inc.php')) {
     include '/etc/phpmyadmin/config.user.inc.php';
 }
+
+/* Support additional configurations */
+if (is_dir('/etc/phpmyadmin/conf.d/')) {
+    foreach (glob('/etc/phpmyadmin/conf.d/*.php') as $filename) {
+        include $filename;
+    }
+}

Relevant Maintainers:

@tianon tianon merged commit c6f0f21 into docker-library:master Jul 5, 2023
@tianon
Copy link
Member

tianon commented Jul 5, 2023

Nice, thanks for updating!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing libraries for gd/zip extensions

3 participants