@@ -34,12 +34,17 @@ RUN --mount=type=cache,sharing=private,target=/var/cache/apt \
3434 \
3535 set -eux; \
3636 \
37- # Empty the conf file to remove all existing certificates
38- echo '' > /etc/ca-certificates.conf; \
39- # Regenerate /etc/ssl/certs/ca-certificates.crt to use the cURL.se provided CA bundle
40- update-ca-certificates --verbose --fresh; \
41- # Symlink the OpenSSL default cert file path to ca-certificates generated file path
42- ln -vfs /etc/ssl/certs/ca-certificates.crt /usr/lib/ssl/cert.pem; \
37+ flush_ca_certificates() { \
38+ # Empty the conf file to remove all existing certificates
39+ echo '' > /etc/ca-certificates.conf; \
40+ # Regenerate /etc/ssl/certs/ca-certificates.crt to use the cURL.se provided CA bundle
41+ update-ca-certificates --verbose --fresh; \
42+ # Symlink the OpenSSL default cert file path to ca-certificates generated file path
43+ ln -vfs /etc/ssl/certs/ca-certificates.crt /usr/lib/ssl/cert.pem; \
44+ }; \
45+ \
46+ # Flush CA certificates first with our good bundle
47+ flush_ca_certificates; \
4348 \
4449 savedAptMark="$(apt-mark showmanual)" ; \
4550 apt-get update; \
@@ -86,6 +91,9 @@ RUN --mount=type=cache,sharing=private,target=/var/cache/apt \
8691 # Upgrade apt packages
8792 apt-get upgrade -y; \
8893 \
94+ # Flush CA certificates again in case upgrade reset everything
95+ flush_ca_certificates; \
96+ \
8997 # Install persistent apt packages
9098 apt-get install -y --no-install-recommends \
9199 # PDF preview rendering for WordPress
0 commit comments