-
Notifications
You must be signed in to change notification settings - Fork 358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Dockerfile, install Chrome and Chromedriver #565
base: master
Are you sure you want to change the base?
Conversation
This would solve #561 |
1aa249b
to
f4eea6f
Compare
as wraith now supports headless chrome, it can be installed in the docker container - also update nodejs to version 8 and use the ruby version specified by the repository's .ruby-version file
I tried this out locally, and got the following block of errors:
|
What does your config file look like? |
I just tried this out and it works perfectly. Ideal for anyone who's in the same situation as me where they can't use PhantomJS because flex support is sketchy. @rbayliss the reason you get that error is because your js scripts are in a module format (not supported when using chrome). See this example for how to write scripts for chrome. |
Thanks a lot! This used to work for me, but now I keep getting However, it doesn't happen every time. Running this for only one url and 1366 width leads to no issues, adding more resolutions/urls or changing width size breaks ~80% of images.
What's interesting that addition of another url breaks even the url that previously worked. Testing one url at 1366 works, but two urls at 1366 break both of them. Could chrome be somehow "overloaded"? Any ideas? TIA! |
@viktoradavid I was running into a similar problem. Seems like chrome needs more resources than the default docker box offers. Try running your When I did this I no longer got |
@bbrooks That's what I needed, thank you so much! BTW I had to increase the |
I think we should use docker compose and have chrome or whatever in a separate container so we can use Firefox or whatever we want, or add it to a bigger compose that already have selenium with chrome for lets say use behat. This way we do not have 2 chromes there. |
@edurenye I agree but how would we get wraith to look for and use the dockerized chrome instead of trying to execute it on the wraith container? |
With an ENV variable somehow, maybe? I don't know, we have to figure it out. |
I just tried to use this for the first time, but am running in to some problems. google-chrome 76 is installed, and ChromeDriver 77, so when you try to run wraith it complains there is a version mismatch and doesn't run.
|
I just had the same problem, it installed Chrome 79 but ChromeDriver 80, and this helped for me:
It would be great to detect what Chrome version gets installed and match ChromeDriver with it but I haven't looked into it, it's not that much of a hassle to manually update the version number. I also moved the Chrome setup steps last so that it doesn't re-execute the font downloads whenever I need to retry the Chrome related stuff, and moved the version output last for easier comparison. Here's my full FROM ruby:2.4.1
WORKDIR /wraith
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
RUN apt-get install -y libfreetype6 libfontconfig1 nodejs libnss3-dev libgconf-2-4 \
&& rm -rf /var/lib/apt/lists/*
# make sure npm does not need sudo: https://docs.npmjs.com/getting-started/fixing-npm-permissions
RUN mkdir /wraith/.npm-global
ENV NPM_CONFIG_PREFIX=/wraith/.npm-global
ENV PATH=/wraith/.npm-global/bin:$PATH
# install with --unsafe-perm because of https://github.com/Medium/phantomjs/issues/707
RUN npm install -g phantomjs-prebuilt casperjs --unsafe-perm
RUN gem install wraith --no-rdoc --no-ri
# Make sure decent fonts are installed. Thanks to http://www.dailylinuxnews.com/blog/2014/09/things-to-do-after-installing-debian-jessie/
RUN echo "deb http://ftp.us.debian.org/debian jessie main contrib non-free" | tee -a /etc/apt/sources.list
RUN echo "deb http://security.debian.org/ jessie/updates contrib non-free" | tee -a /etc/apt/sources.list
RUN apt-get update
RUN apt-get install -y ttf-freefont ttf-mscorefonts-installer ttf-bitstream-vera ttf-dejavu ttf-liberation
# Make sure a recent (>6.7.7-10) version of ImageMagick is installed.
RUN apt-get install -y imagemagick
# install chrome and chromedriver (unzip is needed for installing chromedriver)
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& echo "deb https://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google.list \
&& apt-get update \
&& apt-get install -y google-chrome-stable unzip \
&& rm -rf /var/lib/apt/lists/* \
&& sed -i 's|HERE/chrome"|HERE/chrome" --disable-setuid-sandbox --no-sandbox|g' \
"/opt/google/chrome/google-chrome"
RUN export CHROMEDRIVER_RELEASE=$(curl --location --fail --retry 3 https://chromedriver.storage.googleapis.com/LATEST_RELEASE_79) \
&& curl --silent --show-error --location --fail --retry 3 --output /tmp/chromedriver_linux64.zip "https://chromedriver.storage.googleapis.com/$CHROMEDRIVER_RELEASE/chromedriver_linux64.zip" \
&& cd /tmp \
&& unzip chromedriver_linux64.zip \
&& rm -rf chromedriver_linux64.zip \
&& chmod +x chromedriver \
&& mv chromedriver /usr/local/bundle/bin/chromedriver
RUN google-chrome --version \
&& chromedriver --version
ENTRYPOINT [ "wraith" ] |
As wraith now supports headless chrome, it can be installed in the Docker container.
Also update nodejs to version 8 and use the ruby version specified by the repository's
.ruby-version
file.After having built this locally
info
prints: