Question

Dockerfile for Laravel app to install libraries

Hello,

The package spatie/laravel-pdf requires underlying Browshershot and Puppeteer. Missing libraries must be installed for this, like libnss3.

[2024-09-06 09:35:03] production. ERROR: The command "PATH=$PATH:/usr/local/bin:/opt/homebrew/bin NODE_PATH=`npm root -g' node '/workspace/vendor/spatie/browsershot/src/ .. /bin/browser.cjs' '{"url":"file:\/\/\/tmp\/1167844844-0405832001725615302\/index.html","action":"pdf","options": {"args": [" -- no-sandbox" ], "viewport": {"width": 800, "height":600},"displayHeaderFooter":false, "printBackground" : true}}'" failed.

Working directory: /workspace/public

Error: Failed to launch the browser process!
/workspace/.cache/puppeteer/chrome/linux-127.0.6533.88/chrome-linux64/chrome: error while loading shared libraries: libnss3
cannot open shared object file: No such file or directory

If I understand correctly, you have to create your own Dockerfile for this. I use App Platform so I didn’t have to do this, so I don’t know how to get this done.

Is there a Dockerfile example for a Laravel app?


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more