Last active
September 20, 2024 15:16
-
-
Save Faq/8821c5fd18dd01da4f80d7435158096d to your computer and use it in GitHub Desktop.
Install chrome & chromedriver for Docker image 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Source: https://gist.github.com/varyonic/dea40abcf3dd891d204ef235c6e8dd79 | |
Change log: | |
1. replaced "dl-ssl.google.com" with "dl.google.com" according https://www.google.com/linuxrepositories/ | |
2. replaced "apt-key" as "Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8))." | |
3. use https | |
Oneliner for Dockerfile: | |
RUN set -ex; \ | |
apt-get update; \ | |
apt-get install -y gnupg wget curl unzip --no-install-recommends; \ | |
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | \ | |
gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/google.gpg --import; \ | |
chmod 644 /etc/apt/trusted.gpg.d/google.gpg; \ | |
echo "deb https://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list; \ | |
apt-get update -y; \ | |
apt-get install -y google-chrome-stable; \ | |
CHROME_VERSION=$(google-chrome --product-version | grep -o "[^\.]*\.[^\.]*\.[^\.]*"); \ | |
CHROMEDRIVER_VERSION=$(curl -s "https://chromedriver.storage.googleapis.com/LATEST_RELEASE_$CHROME_VERSION"); \ | |
wget -q --continue -P /chromedriver "https://chromedriver.storage.googleapis.com/$CHROMEDRIVER_VERSION/chromedriver_linux64.zip"; \ | |
unzip /chromedriver/chromedriver* -d /usr/local/bin/ | |
# To check it after (chrome and chromedriver versions will be the same): | |
$ docker run --rm -it put_docker_image_name_here bash | |
$ google-chrome --version | |
$ chromedriver -v |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is my docker file. I am crawling using requests_html. I am facing the issue of html.render() function getting freezed and not executing. My system is Mac with Apple Silicon. Same docker was working fine on a Windows machine.