Skip to content

Instantly share code, notes, and snippets.

@lsm
Forked from kenfehling/Dockerfile
Created December 17, 2017 07:29
Show Gist options
  • Save lsm/4149526a045887eb0c7a1c93795b1316 to your computer and use it in GitHub Desktop.
Save lsm/4149526a045887eb0c7a1c93795b1316 to your computer and use it in GitHub Desktop.
Docker: Ubuntu 16.04 with Node 6.10.2, Selenium Standalone, Chrome Headless
FROM ubuntu:16.04
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
apt-transport-https \
openjdk-8-jre-headless \
curl \
xz-utils \
unzip \
bzip2 \
wget \
&& rm -rf /var/lib/apt/lists/*
#==========
# Chrome
#==========
RUN wget -q -O - https://dl.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-chrome.list \
&& apt-get update -qqy \
&& apt-get -qqy install google-chrome-unstable \
&& rm /etc/apt/sources.list.d/google-chrome.list \
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*
RUN mkdir /data
#==========
# Selenium
#==========
RUN mkdir -p /opt/selenium \
&& wget --no-verbose https://selenium-release.storage.googleapis.com/3.4/selenium-server-standalone-3.4.0.jar -O /opt/selenium/selenium-server-standalone.jar
#==================
# Chrome webdriver
#==================
ARG CHROME_DRIVER_VERSION=2.29
RUN wget --no-verbose -O /tmp/chromedriver_linux64.zip https://chromedriver.storage.googleapis.com/$CHROME_DRIVER_VERSION/chromedriver_linux64.zip \
&& rm -rf /opt/selenium/chromedriver \
&& unzip /tmp/chromedriver_linux64.zip -d /opt/selenium \
&& rm /tmp/chromedriver_linux64.zip \
&& mv /opt/selenium/chromedriver /opt/selenium/chromedriver-$CHROME_DRIVER_VERSION \
&& chmod 755 /opt/selenium/chromedriver-$CHROME_DRIVER_VERSION \
&& ln -fs /opt/selenium/chromedriver-$CHROME_DRIVER_VERSION /usr/bin/chromedriver
ENV NPM_CONFIG_LOGLEVEL info
ENV NODE_VERSION 6.10.2
#==========
# NodeJS
#==========
RUN curl -SLO https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.xz \
&& tar -xJf node-v$NODE_VERSION-linux-x64.tar.xz -C /usr/local --strip-components=1 \
&& rm node-v$NODE_VERSION-linux-x64.tar.xz \
&& ln -s /usr/local/bin/node /usr/local/bin/nodejs
# Following line fixes
# https://github.com/SeleniumHQ/docker-selenium/issues/87
ENV DBUS_SESSION_BUS_ADDRESS=/dev/null
ENTRYPOINT java -jar /opt/selenium/selenium-server-standalone.jar
EXPOSE 4444
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment