Use mountpoint check and add util-linux-misc dependency

Address review feedback: use `mountpoint -q` instead of find to
detect mounted CA directory, add set -x/+x for debug logging,
broaden glob to accept any file extension, and add util-linux-misc
package to Dockerfile for the mountpoint command.

Signed-off-by: Tomas <16553087+michnovka@users.noreply.github.com>
This commit is contained in:
Tomas
2026-03-06 14:42:35 +01:00
parent 7cd2ac1bbd
commit 909ef96748
2 changed files with 6 additions and 3 deletions

View File

@@ -70,7 +70,8 @@ RUN set -ex; \
libwebsockets \
\
shadow \
grep; \
grep \
util-linux-misc; \
useradd --system -u 1000 eturnal; \
apk del --no-cache \
shadow; \

View File

@@ -21,16 +21,18 @@ fi
# Trust additional CA certificates, if the user provided NEXTCLOUD_TRUSTED_CACERTS_DIR
# The container is read-only, so we build a custom bundle in /tmp (tmpfs) and
# point Go's TLS stack to it via SSL_CERT_FILE.
if [ -n "$(find /usr/local/share/ca-certificates -name '*.crt' -type f 2>/dev/null)" ]; then
if mountpoint -q /usr/local/share/ca-certificates; then
echo "Trusting additional CA certificates..."
set -x
cp /etc/ssl/certs/ca-certificates.crt /tmp/ca-certificates.crt
for cert in /usr/local/share/ca-certificates/*.crt; do
for cert in /usr/local/share/ca-certificates/*; do
if [ -f "$cert" ]; then
cat "$cert" >> /tmp/ca-certificates.crt
echo " Added: $(basename "$cert")"
fi
done
export SSL_CERT_FILE=/tmp/ca-certificates.crt
set +x
fi
set -x