From afb114531c8b5f8961b3df08d27feaf5b8666220 Mon Sep 17 00:00:00 2001 From: Vlad Frangu Date: Wed, 9 Sep 2026 15:41:09 +0200 Subject: [PATCH 1/2] fix: resolve Camoufox browser and certificate library paths --- node-playwright-camoufox/Dockerfile | 13 ++++++++----- python-playwright-camoufox/Dockerfile | 13 ++++++++----- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/node-playwright-camoufox/Dockerfile b/node-playwright-camoufox/Dockerfile index 6a6b4089..eebb30b3 100644 --- a/node-playwright-camoufox/Dockerfile +++ b/node-playwright-camoufox/Dockerfile @@ -26,8 +26,8 @@ ENV PLAYWRIGHT_BROWSERS_PATH=/pw-browsers # Tell the crawlee cli that we already have browsers installed, so it skips installing them ENV CRAWLEE_SKIP_BROWSER_INSTALL=1 -# Camoufox stores its browser in ~/.cache/camoufox -ENV APIFY_DEFAULT_BROWSER_PATH=/home/myuser/.cache/camoufox/camoufox-bin +# Stable symlink to the installed Camoufox executable. +ENV APIFY_DEFAULT_BROWSER_PATH=/home/myuser/.cache/camoufox-bin # Prevent installing of browsers by future `npm install`. ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 @@ -139,9 +139,12 @@ RUN npm --quiet set progress=false \ \ # Install Camoufox browser && PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=0 npx camoufox-js fetch \ - # Overrides the dynamic library used by Firefox to determine trusted root certificates with p11-kit-trust.so, which loads the system certificates. - && rm -f /home/myuser/.cache/camoufox/libnssckbi.so \ - && ln -s $(ls -d /usr/lib/*-linux-gnu)/pkcs11/p11-kit-trust.so /home/myuser/.cache/camoufox/libnssckbi.so \ + # Resolve both flat and versioned Camoufox cache layouts. + && CAMOUFOX_BINARY="$(find /home/myuser/.cache/camoufox -type f -name camoufox-bin)" \ + && test -x "$CAMOUFOX_BINARY" \ + && ln -s "$CAMOUFOX_BINARY" "$APIFY_DEFAULT_BROWSER_PATH" \ + # Load system certificates from the browser's own library directory. + && ln -sf "$(ls -d /usr/lib/*-linux-gnu)/pkcs11/p11-kit-trust.so" "$(dirname "$CAMOUFOX_BINARY")/libnssckbi.so" \ \ && npm install --omit=dev --omit=optional --no-package-lock --prefer-online \ && npm install --no-package-lock --prefer-online --no-save impit@latest \ diff --git a/python-playwright-camoufox/Dockerfile b/python-playwright-camoufox/Dockerfile index 2222db6e..8d818337 100644 --- a/python-playwright-camoufox/Dockerfile +++ b/python-playwright-camoufox/Dockerfile @@ -46,8 +46,8 @@ ENV CRAWLEE_SKIP_BROWSER_INSTALL=1 # Prevent playwright from downloading browsers when users install playwright via pip ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 -# Camoufox stores its browser in ~/.cache/camoufox -ENV APIFY_DEFAULT_BROWSER_PATH=/root/.cache/camoufox/camoufox-bin +# Stable symlink to the installed Camoufox executable. +ENV APIFY_DEFAULT_BROWSER_PATH=/root/.cache/camoufox-bin # Copy the script for registering intermediate certificates and the pre-downloaded certificates COPY ./register_intermediate_certs.sh ./register_intermediate_certs.sh @@ -111,9 +111,12 @@ RUN python -m pip install --upgrade \ camoufox[geoip]~=${CAMOUFOX_VERSION} \ # Fetch the Camoufox browser && python -m camoufox fetch \ - # Overrides the dynamic library used by Firefox to determine trusted root certificates with p11-kit-trust.so, which loads the system certificates. - && rm -f /root/.cache/camoufox/libnssckbi.so \ - && ln -s /usr/lib/x86_64-linux-gnu/pkcs11/p11-kit-trust.so /root/.cache/camoufox/libnssckbi.so + # Resolve both flat and versioned Camoufox cache layouts. + && CAMOUFOX_BINARY="$(find /root/.cache/camoufox -type f -name camoufox-bin)" \ + && test -x "$CAMOUFOX_BINARY" \ + && ln -s "$CAMOUFOX_BINARY" "$APIFY_DEFAULT_BROWSER_PATH" \ + # Load system certificates from the browser's own library directory. + && ln -sf "$(ls -d /usr/lib/*-linux-gnu)/pkcs11/p11-kit-trust.so" "$(dirname "$CAMOUFOX_BINARY")/libnssckbi.so" # Copy the dummy source code to the image COPY --chown=myuser:myuser . . From 6dedb97a9a606e81c7cb24cef9a9e361c5026b5c Mon Sep 17 00:00:00 2001 From: Vlad Frangu Date: Wed, 9 Sep 2026 15:48:36 +0200 Subject: [PATCH 2/2] fix: preserve Camoufox companion file lookup --- node-playwright-camoufox/Dockerfile | 6 +++--- python-playwright-camoufox/Dockerfile | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/node-playwright-camoufox/Dockerfile b/node-playwright-camoufox/Dockerfile index eebb30b3..5f22f6ac 100644 --- a/node-playwright-camoufox/Dockerfile +++ b/node-playwright-camoufox/Dockerfile @@ -26,8 +26,8 @@ ENV PLAYWRIGHT_BROWSERS_PATH=/pw-browsers # Tell the crawlee cli that we already have browsers installed, so it skips installing them ENV CRAWLEE_SKIP_BROWSER_INSTALL=1 -# Stable symlink to the installed Camoufox executable. -ENV APIFY_DEFAULT_BROWSER_PATH=/home/myuser/.cache/camoufox-bin +# Stable path through a symlink to the installed Camoufox directory. +ENV APIFY_DEFAULT_BROWSER_PATH=/home/myuser/.cache/camoufox-current/camoufox-bin # Prevent installing of browsers by future `npm install`. ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 @@ -142,7 +142,7 @@ RUN npm --quiet set progress=false \ # Resolve both flat and versioned Camoufox cache layouts. && CAMOUFOX_BINARY="$(find /home/myuser/.cache/camoufox -type f -name camoufox-bin)" \ && test -x "$CAMOUFOX_BINARY" \ - && ln -s "$CAMOUFOX_BINARY" "$APIFY_DEFAULT_BROWSER_PATH" \ + && ln -s "$(dirname "$CAMOUFOX_BINARY")" "$(dirname "$APIFY_DEFAULT_BROWSER_PATH")" \ # Load system certificates from the browser's own library directory. && ln -sf "$(ls -d /usr/lib/*-linux-gnu)/pkcs11/p11-kit-trust.so" "$(dirname "$CAMOUFOX_BINARY")/libnssckbi.so" \ \ diff --git a/python-playwright-camoufox/Dockerfile b/python-playwright-camoufox/Dockerfile index 8d818337..42ea95c2 100644 --- a/python-playwright-camoufox/Dockerfile +++ b/python-playwright-camoufox/Dockerfile @@ -46,8 +46,8 @@ ENV CRAWLEE_SKIP_BROWSER_INSTALL=1 # Prevent playwright from downloading browsers when users install playwright via pip ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 -# Stable symlink to the installed Camoufox executable. -ENV APIFY_DEFAULT_BROWSER_PATH=/root/.cache/camoufox-bin +# Stable path through a symlink to the installed Camoufox directory. +ENV APIFY_DEFAULT_BROWSER_PATH=/root/.cache/camoufox-current/camoufox-bin # Copy the script for registering intermediate certificates and the pre-downloaded certificates COPY ./register_intermediate_certs.sh ./register_intermediate_certs.sh @@ -114,7 +114,7 @@ RUN python -m pip install --upgrade \ # Resolve both flat and versioned Camoufox cache layouts. && CAMOUFOX_BINARY="$(find /root/.cache/camoufox -type f -name camoufox-bin)" \ && test -x "$CAMOUFOX_BINARY" \ - && ln -s "$CAMOUFOX_BINARY" "$APIFY_DEFAULT_BROWSER_PATH" \ + && ln -s "$(dirname "$CAMOUFOX_BINARY")" "$(dirname "$APIFY_DEFAULT_BROWSER_PATH")" \ # Load system certificates from the browser's own library directory. && ln -sf "$(ls -d /usr/lib/*-linux-gnu)/pkcs11/p11-kit-trust.so" "$(dirname "$CAMOUFOX_BINARY")/libnssckbi.so"