Laravel Sail instructions #90
Replies: 4 comments 2 replies
-
|
@piotrjoniec this should be added to the |
Beta Was this translation helpful? Give feedback.
-
|
Hi guys! |
Beta Was this translation helpful? Give feedback.
-
|
I found the complete solution: https://laracasts.com/discuss/channels/laravel/run-browsershot-in-laravel-sail-on-arm64-mac |
Beta Was this translation helpful? Give feedback.
-
|
This all seems extra complicated? This has been working for me: Add chromium as a new service within your docker-compose.yml -- make sure to update the volume and network names to match your app instead of "myapp". chromium:
image: zenika/alpine-chrome
command:
- chromium-browser
- '--headless'
- '--disable-gpu'
- '--remote-debugging-address=0.0.0.0'
- '--remote-debugging-port=9222'
cap_add:
- SYS_ADMIN
volumes:
- 'myapp-chromium:/tmp/chromium'
networks:
- myapp
networks:
myapp:
driver: bridge
volumes:
myapp-chromium:
driver: localThen your main laravel.test service, make sure to give access to your chromium volume, and access to the same network. Update your depends_on as well to include chromium. volumes:
- 'myapp-chromium:/tmp/chromium'
- './src:/var/www/'
networks:
- myapp
depends_on:
- redis
- mailpit
- minio
- selenium
- chromiumInstead of hardcoding IPs, you can do this inside your config/browsershot.php: <?php
return [
'chromium' => [
'host_ip' => gethostbyname(env('BROWSER_SHOT_CHROMIUM_HOSTNAME')),
],
];Add this in your .env BROWSER_SHOT_CHROMIUM_HOSTNAME=chromiumFinally, you can use BrowserShot facade like so: $browser = Browsershot::url($url)
->setRemoteInstance(config('browsershot.chromium.host_ip'))This has been working for me without needing to rebuild the main containers, and use hardcoded IPs. |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
If anyone is trying to get it to work with Laravel Sail, this is what worked for me.
First, make sure to publish the Sail Dockerfile:
Add this at the end of your Dockerfile (before
EXPOSE 8000):RUN npx puppeteer browsers install chrome \ && mkdir /home/sail/.cache \ && mv /root/.cache/puppeteer /home/sail/.cache \ && apt-get update \ && apt-get install -y ca-certificates fonts-liberation libappindicator3-1 libasound2 libatk-bridge2.0-0 libatk1.0-0 \ libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libglib2.0-0 libgtk-3-0 libnspr4 libnss3 libpango-1.0-0 \ libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 \ libxrender1 libxss1 libxtst6 lsb-release wget xdg-utilsRebuild the containers:
Beta Was this translation helpful? Give feedback.
All reactions