I want to download the latest stealth.min.js as a Docker build step.
Things I Tried
Option 1: RUN npx extract-stealth-evasions
The Dockerfile:
FROM ghcr.io/puppeteer/puppeteer:latest as puppeteer
RUN npx extract-stealth-evasions
CMD [ "cat", "stealth.min.js" ]
docker build -t puppeteer-stealth .
Output:
[+] Building 37.5s (5/5) FINISHED docker:desktop-linux
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 525B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 62B 0.0s
=> [internal] load metadata for ghcr.io/puppeteer/puppeteer:latest 0.9s
=> CACHED [1/2] FROM ghcr.io/puppeteer/puppeteer:latest@sha256:035977d02b83ea0b287fcca7a2f7577a5f5f178f8b4f6b79d15ce053c7999c32 0.0s
=> ERROR [2/2] RUN npx extract-stealth-evasions 36.5s
------
> [2/2] RUN npx extract-stealth-evasions:
5.999 npm WARN exec The following package was not found and will be installed: extract-stealth-evasions@2.7.3
35.59
35.59 Puppeteer old Headless deprecation warning:
35.59 In the near future `headless: true` will default to the new Headless mode
35.59 for Chrome instead of the old Headless implementation. For more
35.59 information, please see https://developer.chrome.com/articles/new-headless/.
35.59 Consider opting in early by passing `headless: "new"` to `puppeteer.launch()`
35.59 If you encounter any bugs, please report them to https://github.com/puppeteer/puppeteer/issues/new/choose.
35.59
36.35 /home/pptruser/.npm/_npx/98be265650d3ad17/node_modules/@puppeteer/browsers/lib/cjs/launch.js:267
36.35 reject(new Error([
36.35 ^
36.35
36.35 Error: Failed to launch the browser process!
36.35 [0113/134601.863457:FATAL:zygote_host_impl_linux.cc(127)] No usable sandbox! Update your kernel or see https://chromium.googlesource.com/chromium/src/+/main/docs/linux/suid_sandbox_development.md for more information on developing with the SUID sandbox. If you want to live dangerously and need an immediate workaround, you can try using --no-sandbox.
36.35 qemu: uncaught target signal 5 (Trace/breakpoint trap) - core dumped
36.35
36.35
36.35 TROUBLESHOOTING: https://pptr.dev/troubleshooting
36.35
36.35 at Interface.onClose (/home/pptruser/.npm/_npx/98be265650d3ad17/node_modules/@puppeteer/browsers/lib/cjs/launch.js:267:24)
36.35 at Interface.emit (node:events:526:35)
36.35 at Interface.close (node:internal/readline/interface:527:10)
36.35 at Socket.onend (node:internal/readline/interface:253:10)
36.35 at Socket.emit (node:events:526:35)
36.35 at endReadableNT (node:internal/streams/readable:1408:12)
36.35 at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
36.35
36.35 Node.js v20.9.0
36.39 npm notice
36.39 npm notice New minor version of npm available! 10.1.0 -> 10.3.0
36.39 npm notice Changelog: <https://github.com/npm/cli/releases/tag/v10.3.0>
36.39 npm notice Run `npm install -g npm@10.3.0` to update!
36.39 npm notice
------
Dockerfile:3
--------------------
1 | FROM ghcr.io/puppeteer/puppeteer:latest as puppeteer
2 |
3 | >>> RUN npx extract-stealth-evasions
4 |
5 | CMD [ "cat", "stealth.min.js" ]
--------------------
ERROR: failed to solve: process "/bin/sh -c npx extract-stealth-evasions" did not complete successfully: exit code: 1
FROM ghcr.io/puppeteer/puppeteer:latest as puppeteer
RUN npm i extract-stealth-evasions
COPY index.js .
RUN node index.js
CMD [ "cat", "stealth.min.js" ]
docker build -t puppeteer-stealth .
Output:
[+] Building 5.5s (8/8) FINISHED docker:desktop-linux
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 657B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 62B 0.0s
=> [internal] load metadata for ghcr.io/puppeteer/puppeteer:latest 0.9s
=> [1/4] FROM ghcr.io/puppeteer/puppeteer:latest@sha256:035977d02b83ea0b287fcca7a2f7577a5f5f178f8b4f6b79d15ce053c7999c32 0.0s
=> [internal] load build context 0.0s
=> => transferring context: 2.65kB 0.0s
=> CACHED [2/4] RUN npm i extract-stealth-evasions 0.0s
=> [3/4] COPY index.js . 0.0s
=> ERROR [4/4] RUN node index.js 4.6s
------
> [4/4] RUN node index.js:
2.929
2.929 Puppeteer old Headless deprecation warning:
2.929 In the near future `headless: true` will default to the new Headless mode
2.929 for Chrome instead of the old Headless implementation. For more
2.929 information, please see https://developer.chrome.com/articles/new-headless/.
2.929 Consider opting in early by passing `headless: "new"` to `puppeteer.launch()`
2.929 If you encounter any bugs, please report them to https://github.com/puppeteer/puppeteer/issues/new/choose.
2.929
4.544 /home/pptruser/node_modules/@puppeteer/browsers/lib/cjs/launch.js:267
4.544 reject(new Error([
4.544 ^
4.544
4.544 Error: Failed to launch the browser process!
4.544 qemu: uncaught target signal 5 (Trace/breakpoint trap) - core dumped
4.544 qemu: uncaught target signal 5 (Trace/breakpoint trap) - core dumped
4.544 [0113/135529.093177:ERROR:bus.cc(407)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
4.544 qemu: uncaught target signal 11 (Segmentation fault) - core dumped
4.544
4.544
4.544 TROUBLESHOOTING: https://pptr.dev/troubleshooting
4.544
4.544 at Interface.onClose (/home/pptruser/node_modules/@puppeteer/browsers/lib/cjs/launch.js:267:24)
4.544 at Interface.emit (node:events:526:35)
4.544 at Interface.close (node:internal/readline/interface:527:10)
4.544 at Socket.onend (node:internal/readline/interface:253:10)
4.544 at Socket.emit (node:events:526:35)
4.544 at endReadableNT (node:internal/streams/readable:1408:12)
4.544 at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
4.544
4.544 Node.js v20.9.0
------
Dockerfile:7
--------------------
5 | COPY index.js .
6 |
7 | >>> RUN node index.js
8 |
9 | CMD [ "cat", "stealth.min.js" ]
--------------------
ERROR: failed to solve: process "/bin/sh -c node index.js" did not complete successfully: exit code: 1
Feature request
I want to download the latest stealth.min.js as a Docker build step.
Things I Tried
Option 1:
RUN npx extract-stealth-evasions
The Dockerfile:
Output:
Option 2: Modify index.js
Add launch args in index.js to run without sandbox:
The Dockerfile:
Output:
How do you think we could get this working?