Skip to content

Instantly share code, notes, and snippets.

@tabiodun
Created July 30, 2018 19:43
Show Gist options
  • Save tabiodun/60baca184f6c72cfe398c6c723cc4b67 to your computer and use it in GitHub Desktop.
Save tabiodun/60baca184f6c72cfe398c6c723cc4b67 to your computer and use it in GitHub Desktop.
tabiodun/chrome-headless-node
FROM node:slim
USER root
ARG CHROME_VERSION="google-chrome-stable"
RUN apt-get update && apt-get install -y zip
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list \
&& apt-get update -qqy \
&& apt-get -qqy install \
${CHROME_VERSION:-google-chrome-beta} \
&& rm /etc/apt/sources.list.d/google-chrome.list \
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*
RUN CHROMEDRIVER_VERSION=`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE` && \
mkdir -p /opt/chromedriver-$CHROMEDRIVER_VERSION && \
curl -sS -o /tmp/chromedriver_linux64.zip http://chromedriver.storage.googleapis.com/$CHROMEDRIVER_VERSION/chromedriver_linux64.zip && \
unzip -qq /tmp/chromedriver_linux64.zip -d /opt/chromedriver-$CHROMEDRIVER_VERSION && \
rm /tmp/chromedriver_linux64.zip && \
chmod +x /opt/chromedriver-$CHROMEDRIVER_VERSION/chromedriver && \
ln -fs /opt/chromedriver-$CHROMEDRIVER_VERSION/chromedriver /usr/local/bin/chromedriver
ENTRYPOINT [ "/bin/bash"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment