Replies: 2 comments
-
I'm having trouble setting up puppeteer in my docker, are you willing to share your dockerfile? |
Beta Was this translation helpful? Give feedback.
-
Sure. See my dockerfile below: FROM ubuntu:24.04 LABEL maintainer="Taylor Otwell" ARG WWWGROUP=1000 WORKDIR /var/www/html ENV DEBIAN_FRONTEND=noninteractive RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone RUN echo "Acquire::http::Pipeline-Depth 0;" > /etc/apt/apt.conf.d/99custom && RUN apt-get update && apt-get upgrade -y RUN setcap "cap_net_bind_service=+ep" /usr/bin/php8.4 Copy package.json and package-lock.jsonCOPY package.json package-lock.json /var/www/html/ Install Node.js dependenciesRUN npm install COPY . /var/www/html RUN composer install --optimize-autoloader --no-dev COPY start-container /usr/local/bin/start-container EXPOSE 3000/tcp ENTRYPOINT ["start-container"] In addition to this, you need to add puppeteer to your package.json file so that you can install it with npm install in your dockerfile |
Beta Was this translation helpful? Give feedback.
-
I am attempting to use spatie/laravel-pdf to generate pdf from my laravel sail app. After setting up chromium-broswer via dockerfile, I run into the error below when attempting to generate pdf:
The command "PATH=$PATH:/usr/local/bin:/opt/homebrew/bin NODE_PATH=
npm root -g
node '/var/www/html/vendor/spatie/browsershot/src/../bin/browser.cjs' '{"url":"file:///tmp/1784067815-0690470001738770043/index.html","action":"pdf","options":{"args":["--no-sandbox"],"viewport":{"width":800,"height":600},"displayHeaderFooter":false,"executablePath":"/usr/bin/chromium-browser","waitUntil":"networkidle0","env":{"CHROME_CONFIG_HOME":"/app/.config/puppeteer"}}}'" failed. Exit Code: 1(General error) Working directory: /var/www/html/vendor/laravel/octane/bin Output: ================Error Output: ================ node:fs:1740
const stats = binding.stat( ^ Error: EACCES: permission denied, stat '/root/.config/puppeteer' at Object.statSync (node:fs:1740:25) at isDirectorySync (/var/www/html/node_modules/cosmiconfig/dist/util.js:88:35) at search (/var/www/html/node_modules/cosmiconfig/dist/ExplorerSync.js:47:47) at emplace (/var/www/html/node_modules/cosmiconfig/dist/util.js:36:20) at search (/var/www/html/node_modules/cosmiconfig/dist/ExplorerSync.js:71:50) at emplace (/var/www/html/node_modules/cosmiconfig/dist/util.js:36:20) at search (/var/www/html/node_modules/cosmiconfig/dist/ExplorerSync.js:71:50) at emplace (/var/www/html/node_modules/cosmiconfig/dist/util.js:36:20) at search (/var/www/html/node_modules/cosmiconfig/dist/ExplorerSync.js:71:50) at emplace (/var/www/html/node_modules/cosmiconfig/dist/util.js:36:20) { errno: -13, code: 'EACCES', syscall: 'stat', path: '/root/.config/puppeteer' } Node.js v22.13.1
Has anyone encountered a similar problem?
Beta Was this translation helpful? Give feedback.
All reactions