Skip to content

Replace current hardcoded chromedriver version with dynamic one #885

@mkrei

Description

@mkrei

🚀 Feature Proposal

Currently the Dockerfile for NodeChrome has a hardcoded version of the Chromedriver it is supposed to install, which is not too nice from a maintenance side.
With the new release system Google implemented for the Chromedriver, there should always matching versions of both Chrome and Chromedriver. As such it might make sense to switch to a dynamic install, based on the previously installed Chrome.

Motivation

Avoid having to wait for new PRs to fix possible dependency issues caused by an update of google-chrome-stable and reduce maintenance overhead in total.

Example

The following code (please excuse my rather crude bash code) should retrieve the best match for a given chrome version, so it would automatically update once a build is executed with a new chrome release

# get current chrome version
chrome_version=$(google-chrome --version)
version_string=$(echo "$chrome_version" | grep -oP "\d+\.\d+\.\d+\.\d+")

# extract the major version
mayor_version=$(echo "${version_string%%.*}")

# make use of the LAST_RELEASE file provided by google to get the last chromedriver for that release
wget "https://chromedriver.storage.googleapis.com/LATEST_RELEASE_${mayor_version}"
latest_version=$(cat "LATEST_RELEASE_${mayor_version}")
rm -f "LATEST_RELEASE_${mayor_version}"

# retrieve the matching chromedriver.zip
wget "https://chromedriver.storage.googleapis.com/${latest_version}/chromedriver_linux64.zip"

I'm not sure if this can be executed cleanly directly from the dockerfile, but it should be easy enough to put it in a .sh, execute that from the dockerfile instead of the current hardcoded download and continue with the existing code after the zip was retrieved.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions