Open jankulma-turbine opened 5 years ago
I do the same using panther to scrape and not testing, few days/weeks ago it started not working anymore, i thought it was like #262 but after a bunch of tries with different version here is my current setup that is working.
"symfony/panther": "^0.6.0",
Dockerfile :
FROM php:7.3-apache as base
RUN apt-get update && apt-get install -y \
git \
zip \
libicu-dev \
libzip-dev \
wget \
gnupg2 \
libnss3 \
libasound2 \
fonts-liberation \
libappindicator3-1 \
xdg-utils \
lsb-release \
libxss1 \
&& rm -rf /var/lib/apt/lists/*
RUN docker-php-ext-configure zip --with-libzip
RUN docker-php-ext-install pdo pdo_mysql zip opcache
RUN docker-php-ext-enable opcache
COPY --from=composer:1.8.6 /usr/bin/composer /usr/bin/composer
RUN composer global require hirak/prestissimo
# Install Chrome for Panther
RUN wget https://www.slimjet.com/chrome/download-chrome.php?file=files%2F78.0.3904.97%2Fgoogle-chrome-stable_current_amd64.deb -O /chrome.deb
RUN dpkg -i /chrome.deb || apt-get install -yf
RUN rm /chrome.deb
# Set panther env variable to run in docker
ENV PANTHER_NO_SANDBOX=1
PHP:
$client = Client::createChromeClient(
null,
[
'--window-size=1200,1100',
'--headless',
'--disable-dev-shm-usage',
'--no-sandbox',
],
[],
null
);
$client->request('GET', $url);
$client->followRedirects();
Dockerfile
:docker-compose.yml
:composer.json
:index.php
:All files are in the same location. I run
docker-compose build && docker-compose up
and I'm getting following error:crawler_1 | Fatal error: Uncaught RuntimeException: Could not start chrome (or it crashed) after 30 seconds. in /usr/src/vendor/symfony/panther/src/ProcessManager/WebServerReadinessProbeTrait.php:51
This is similar to https://github.com/symfony/panther/issues/200, however in my case I'm not using panther for tests, but only to scrape, and I really don't know how to fix this. I think my problem might be related to invalid docker / docker-compose files.
Thanks a lot