By Abzor
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?
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!
Hello @abzor
You could use serversideup/php
Docker images as a starting point for your project.
In particular the 8.4-fpm-nginx
tag which integrates nginx and fpm.
An example of a simple Dockerfile
using this image and installing the libnss3
package could be the following:
FROM serversideup/php:8.4-fpm-nginx
# Switch to root so we can do root things
USER root
# Install nss3 library
RUN apt update && apt install -y libnss3
# Drop back to our unprivileged user
USER www-data
COPY --chown=www-data:www-data . /var/www/html
RUN composer install --optimize-autoloader --prefer-dist --no-dev --no-interaction
Let me know if this works for you.
Daniel, Founder of Deckrun
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.