astefanutti / decktape

PDF exporter for HTML presentations
MIT License
2.19k stars 176 forks source link

Run docker image in Apple M1 #231

Closed jabrena closed 1 year ago

jabrena commented 3 years ago

Hi,

I am trying to use Decktape with Docker but when I run the container I receive the following error in my Apple M1:

WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
Error: Protocol error (Target.setDiscoverTargets): Target closed.
    at /decktape/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:71:63
    at new Promise (<anonymous>)
    at Connection.send (/decktape/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:70:16)
    at Function.create (/decktape/node_modules/puppeteer/lib/cjs/puppeteer/common/Browser.js:95:26)
    at ChromeLauncher.launch (/decktape/node_modules/puppeteer/lib/cjs/puppeteer/node/Launcher.js:101:56)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async /decktape/decktape.js:193:19

How to solve the issue?

Many thanks in advance

Juan Antonio

cchet commented 2 years ago

Setting the environment variable DOCKER_DEFAULT_PLATFORM=linux/amd64 forced Docker to download the arm64 node image, but I am facing another issue.

docker run --rm --net=host -t -v /Users/het/github/gepardec/presentations:/slides astefanutti/decktape:3.1.0 reveal --size=1920x1080 --pause 2000 --load-pause 2000 http://localhost:8080 docs/Training-for-Containerization.pdf
Error: Protocol error (Target.setDiscoverTargets): Target closed.
    at /decktape/node_modules/puppeteer/lib/cjs/common/Connection.js:71:63
    at new Promise (<anonymous>)
    at Connection.send (/decktape/node_modules/puppeteer/lib/cjs/common/Connection.js:70:16)
    at Function.create (/decktape/node_modules/puppeteer/lib/cjs/common/Browser.js:95:26)
    at ChromeLauncher.launch (/decktape/node_modules/puppeteer/lib/cjs/node/Launcher.js:106:53)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async /decktape/decktape.js:193:19
cchet commented 2 years ago

My problem seems to be the installed chromium version which is set hardcoded in the Dockerfile.

I build the image manually on my M1 with chromium version defined and it worked. No more Error: Protocol error (Target.setDiscoverTargets): Target closed. error

cchet commented 2 years ago

Created a PR from my fork where the chromium version has been updated.

https://github.com/astefanutti/decktape/pull/245

cchet commented 2 years ago

Building it locally fixes the root cause of the issue. The chromium version fixes my error, because the chromium version is too old to support ARM. Actually both things need to be done, building for ARM and updating the chrome version.

astefanutti commented 2 years ago

Building it locally fixes the root cause of the issue. The chromium version fixes my error, because the chromium version is too old to support ARM. Actually both things need to be done, building for ARM and updating the chrome version.

Thanks for the precision. I'll work on the multi-architecture image build ASAP.

cchet commented 2 years ago

Hi, what is the state of this issue?

astefanutti commented 2 years ago

Hi, what is the state of this issue?

This has yet to be worked out. You may want to subscribe to that issue to get notified when the status changes.