Created
October 19, 2023 16:41
-
-
Save trobrock/337a54097ca73db808e85aed341c80d1 to your computer and use it in GitHub Desktop.
Dockerfile
This file contains 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
FROM ruby:3.2.2 | |
# Set up the Chrome PPA | |
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - | |
RUN echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list | |
# Update the package list and install chrome | |
RUN apt-get update -y | |
RUN apt-get install -y google-chrome-stable | |
# Set up Chromedriver Environment variables | |
ENV CHROMEDRIVER_DIR /chromedriver | |
RUN mkdir $CHROMEDRIVER_DIR | |
# Download and install Chromedriver | |
RUN export CHROME_VERSION="$(google-chrome --version | awk '{ print $3 }' | sed -r 's/\.[0-9]+$//')" \ | |
&& export CHROMEDRIVER_URL=$(curl --silent https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json | jq -r "last(.versions[] | select(.version | startswith(\"$CHROME_VERSION\"))) | .downloads.chromedriver[] | select(.platform==\"linux64\") | .url") \ | |
&& echo "Using chromedriver url: $CHROMEDRIVER_URL" \ | |
&& wget -q --continue -P $CHROMEDRIVER_DIR "$CHROMEDRIVER_URL" \ | |
&& unzip $CHROMEDRIVER_DIR/chromedriver* -d $CHROMEDRIVER_DIR | |
# Put Chromedriver into the PATH | |
ENV PATH "${CHROMEDRIVER_DIR}/chromedriver-linux64":$PATH |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment