Skip to content

Commit

Permalink
Docker support (#370)
Browse files Browse the repository at this point in the history
* Add Docker support
* Prevent accidentally leaking .selenium folder when developing
* Added Docker cli commands to README
  • Loading branch information
serbanghita committed Jun 18, 2018
1 parent cb8319d commit 3cd4161
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
@@ -0,0 +1,3 @@
node_modules
npm-debug.log
.selenium
57 changes: 57 additions & 0 deletions Dockerfile
@@ -0,0 +1,57 @@
FROM ubuntu:latest

ENV NODE_VERSION 8.11.2

LABEL maintainer="Vincent Voyer <vincent@zeroload.net>"

ENV LC_ALL=C
ENV DEBIAN_FRONTEND=noninteractive
ENV DEBCONF_NONINTERACTIVE_SEEN=true

EXPOSE 4444

RUN apt-get -qqy update
RUN apt-get -qqy install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common \
sudo
RUN curl -sS -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-chrome.list
RUN echo "deb http://archive.ubuntu.com/ubuntu xenial main universe\n" > /etc/apt/sources.list \
&& echo "deb http://archive.ubuntu.com/ubuntu xenial-updates main universe\n" >> /etc/apt/sources.list \
&& echo "deb http://security.ubuntu.com/ubuntu xenial-security main universe\n" >> /etc/apt/sources.list
RUN apt-get -qqy update


RUN groupadd --gid 1000 node \
&& useradd --uid 1000 --gid node --shell /bin/bash --create-home node
RUN echo 'node ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers

RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
RUN apt-get -qqy --no-install-recommends install \
nodejs \
firefox \
google-chrome-stable \
openjdk-8-jre-headless \
xvfb \
xfonts-100dpi \
xfonts-75dpi \
xfonts-scalable \
xfonts-cyrillic

RUN export DISPLAY=:99.0
RUN Xvfb :99 -shmem -screen 0 1366x768x16 &

WORKDIR /home/node
# For development
# ADD . ./selenium-standalone-local
# RUN chown node:node -R .
USER node
RUN npm init -y
# RUN npm install -i ./selenium-standalone-local
RUN npm install -i selenium-standalone


CMD DEBUG=selenium-standalone:* ./node_modules/.bin/selenium-standalone install && DEBUG=selenium-standalone:* ./node_modules/.bin/selenium-standalone start
7 changes: 7 additions & 0 deletions README.md
Expand Up @@ -292,6 +292,13 @@ $ DEBUG=selenium-standalone:* selenium-standalone install --drivers.chrome.versi

- [Gulp + WebdriverIO + Mocha](https://twin.github.io/selenium-testing-workflow-with-webdriverio/)

### Docker

1. `git clone git@github.com:vvo/selenium-standalone.git`
1. `cd selenium-standalone`
1. `docker build -f Dockerfile -t vvo/selenium-standalone . --rm`
1. `docker run -p 4444:4444 vvo/selenium-standalone`

### Release

```sh
Expand Down

0 comments on commit 3cd4161

Please sign in to comment.