Installation on Alpine Linux #150
Replies: 5 comments
-
I have the same issue |
Beta Was this translation helpful? Give feedback.
-
This also happened to me, any solution? |
Beta Was this translation helpful? Give feedback.
-
I found the answer in documentation. Edit it is still randomly happening to me, maybe someone could provide better answer. |
Beta Was this translation helpful? Give feedback.
-
Hi. Here's a step-by-step guide on how to set it up:
FROM alpine:3.17
# Install required packages
RUN apk add --no-cache \
chromium \
nss \
freetype \
freetype-dev \
harfbuzz \
ca-certificates \
ttf-freefont \
nodejs \
npm
# Add the directory for the Chrome user data
ENV PUPPETEER_EXECUTABLE_PATH="/usr/bin/chromium-browser"
# Set the working directory
WORKDIR /var/www
# Copy the necessary files
COPY package*.json ./
# Install Node.js dependencies
RUN npm install --production
# Copy the rest of the application files
COPY . .
# Install the package
composer require spatie/laravel-pdf
# Configure the package
# Add the following line to your config/pdf.php file
'isRemoteEnabled' => true,
docker build -t your-image-name .
docker run -p 8000:8000 your-image-name After following these steps, you should be able to use the laravel-pdf package in your Alpine Docker container. Please note that this is a general guide, and you might need to adjust the steps based on your specific project requirements and Laravel version. Additionally, if you encounter any issues or errors, you can try the following troubleshooting steps:
If you continue to face issues, it's recommended to check the official documentation of the laravel-pdf package and any relevant community discussions for additional guidance or updates. |
Beta Was this translation helpful? Give feedback.
-
Hi, thanks for the solution, but I don't use docker. My solution is to install Puppeteer and use the withBrowsershot function with the location of your npm and node on your computer.
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I want to use laravel-pdf in a alpine docker container. I think I have to install chrome. But every solution i tested does not work. Has anyone some ideas or best practices?
The command "PATH=$PATH:/usr/local/bin:/opt/homebrew/bin NODE_PATH=
npm root -g
node '/app/vendor/spatie/browsershot/src/../bin/browser.cjs' '{"url":"file:///tmp/331362770-0305509001717163805/index.html","action":"pdf","options":{"args":[],"viewport":{"width":800,"height":600},"displayHeaderFooter":false,"printBackground":true}}'" failed. Exit Code: 1(General error) Working directory: /app/public Output: ================ Error Output: ================ Error: Could not find Chrome (ver. 125.0.6422.78). This can occur if either 1. you did not perform an installation before running the script (e.g.npx puppeteer browsers install chrome
) or 2. your cache path is incorrectly configured (which is: /.cache/puppeteer). For (2), check out our guide on configuring puppeteer at https://pptr.dev/guides/configuration. at ChromeLauncher.resolveExecutablePath (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/node/ProductLauncher.js:295:27) at ChromeLauncher.executablePath (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/node/ChromeLauncher.js:209:25) at ChromeLauncher.computeLaunchArguments (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/node/ChromeLauncher.js:89:37) at async ChromeLauncher.launch (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/node/ProductLauncher.js:70:28) at async callChrome (/app/vendor/spatie/browsershot/bin/browser.cjs:92:23)Beta Was this translation helpful? Give feedback.
All reactions