Skip to content

Commit db20142

Browse files
committed
Change Chrome Node to run Selenium Node Directly
Remove init script for running Selenium node in favor of running the jar directly. Part of #3
1 parent e130d99 commit db20142

File tree

14 files changed

+74
-154
lines changed

14 files changed

+74
-154
lines changed

Makefile

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,7 @@ nodebase: base
2222
cd ./NodeBase && docker build -t $(NAME)/node-base:$(VERSION) .
2323

2424
chrome: nodebase
25-
rm -rf chrome_image
26-
mkdir -p chrome_image/build/chrome
27-
cp build/Dockerfile chrome_image/Dockerfile
28-
cp build/install.sh chrome_image/build/install.sh
29-
cp $(COPYARGS) build/chrome chrome_image/build/
30-
cd ./chrome_image && docker build -t $(NAME)/node-chrome:$(VERSION) .
25+
cd ./NodeChrome && docker build -t $(NAME)/node-chrome:$(VERSION) .
3126

3227
firefox: nodebase
3328
rm -rf firefox_image

NodeBase/Dockerfile

Lines changed: 12 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,8 @@
1-
FROM elgalu/selenium-base:2.44.0
1+
FROM selenium/base:2.44.0
22
MAINTAINER Selenium <[email protected]>
33

4-
#=================
5-
# Locale settings
6-
#=================
7-
ENV LANGUAGE en_US.UTF-8
8-
ENV LANG en_US.UTF-8
9-
RUN locale-gen en_US.UTF-8 \
10-
&& dpkg-reconfigure --frontend noninteractive locales \
11-
&& apt-get update -qqy \
12-
&& apt-get -qqy --no-install-recommends install \
13-
language-pack-en \
14-
&& rm -rf /var/lib/apt/lists/*
4+
ENV DEBIAN_FRONTEND noninteractive
5+
ENV DEBCONF_NONINTERACTIVE_SEEN true
156

167
#===================
178
# Timezone settings
@@ -26,47 +17,23 @@ RUN echo "US/Pacific" | sudo tee /etc/timezone \
2617
#==============
2718
RUN apt-get update -qqy \
2819
&& apt-get -qqy install \
29-
x11vnc \
3020
xvfb \
31-
&& rm -rf /var/lib/apt/lists/* \
32-
&& mkdir -p /home/seluser/.vnc \
33-
&& x11vnc -storepasswd secret /home/seluser/.vnc/passwd \
34-
&& chmod +r /home/seluser/.vnc/passwd
35-
36-
#=======
37-
# Fonts
38-
#=======
39-
RUN apt-get update -qqy \
40-
&& apt-get -qqy --no-install-recommends install \
41-
fonts-ipafont-gothic \
42-
xfonts-100dpi \
43-
xfonts-75dpi \
44-
xfonts-cyrillic \
45-
xfonts-scalable \
4621
&& rm -rf /var/lib/apt/lists/*
4722

48-
#=========
49-
# fluxbox
50-
# A fast, lightweight and responsive window manager
51-
#=========
52-
RUN apt-get update -qqy \
53-
&& apt-get -qqy --no-install-recommends install \
54-
fluxbox \
55-
&& rm -rf /var/lib/apt/lists/*
56-
57-
#===================================================================================
58-
# Scripts to run Xvfb, x11vnc, fluxbox, selenium hub, and selenium node as services
59-
#===================================================================================
60-
COPY ./etc /etc
61-
RUN chmod +x /etc/my_init.d/*.sh \
62-
&& chmod +x /etc/service/**/run
23+
#==============================
24+
# Scripts to run Selenium Node
25+
#==============================
26+
COPY entry_point.sh /opt/bin/entry_point.sh
27+
RUN chmod +x /opt/bin/entry_point.sh
6328

6429
#============================
6530
# Some configuration options
6631
#============================
6732
ENV SCREEN_WIDTH 1360
6833
ENV SCREEN_HEIGHT 1020
6934
ENV SCREEN_DEPTH 24
70-
ENV DISPLAY :20.0
35+
ENV DISPLAY :99.0
36+
37+
USER seluser
7138

72-
EXPOSE 5900
39+
CMD /opt/bin/entry_point.sh

NodeBase/entry_point.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
export GEOMETRY="$SCREEN_WIDTH""x""$SCREEN_HEIGHT""x""$SCREEN_DEPTH"
3+
4+
if [ ! -e /opt/selenium/config.json ]; then
5+
echo No Selenium Node configuration file, the node-base image is not intended to be run directly. 1>&2
6+
exit 1
7+
fi
8+
9+
if [ -z "$HUB_PORT_4444_TCP_ADDR" ]; then
10+
echo Not linked with a running Hub container 1>&2
11+
exit 1
12+
fi
13+
14+
# TODO: Look into http://www.seleniumhq.org/docs/05_selenium_rc.jsp#browser-side-logs
15+
16+
exec xvfb-run --server-args="$DISPLAY -screen 0 $GEOMETRY -ac +extension RANDR" \
17+
java -jar /opt/selenium/selenium-server-standalone.jar \
18+
-role node \
19+
-hub http://hub:4444/grid/register \
20+
-nodeConfig /opt/selenium/config.json

NodeBase/etc/service/fluxbox/run

Lines changed: 0 additions & 8 deletions
This file was deleted.

NodeBase/etc/service/sel-node-emulator/run

Lines changed: 0 additions & 5 deletions
This file was deleted.

NodeBase/etc/service/sel-node/run

Lines changed: 0 additions & 20 deletions
This file was deleted.

NodeBase/etc/service/service-emulator/run

Lines changed: 0 additions & 4 deletions
This file was deleted.

NodeBase/etc/service/x11vnc/run

Lines changed: 0 additions & 10 deletions
This file was deleted.

NodeBase/etc/service/xvfb/run

Lines changed: 0 additions & 7 deletions
This file was deleted.

NodeChrome/Dockerfile

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
FROM selenium/node-base:2.44.0
2+
MAINTAINER Selenium <[email protected]>
3+
4+
USER root
5+
6+
#===============
7+
# Google Chrome
8+
#===============
9+
# TODO: IronPort (My Corporate Firewall) - Remove --no-check-certificate flag
10+
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub --no-check-certificate | apt-key add - \
11+
&& echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list \
12+
&& apt-get update -qqy \
13+
&& apt-get -qqy install \
14+
google-chrome-stable \
15+
&& rm /etc/apt/sources.list.d/google-chrome.list \
16+
&& rm -rf /var/lib/apt/lists/*
17+
18+
#==================
19+
# Chrome webdriver
20+
#==================
21+
ENV CHROME_DRIVER_VERSION 2.12
22+
RUN wget --no-verbose -O /tmp/chromedriver_linux64.zip http://chromedriver.storage.googleapis.com/$CHROME_DRIVER_VERSION/chromedriver_linux64.zip \
23+
&& rm -rf /opt/selenium/chromedriver \
24+
&& unzip /tmp/chromedriver_linux64.zip -d /opt/selenium \
25+
&& rm /tmp/chromedriver_linux64.zip \
26+
&& mv /opt/selenium/chromedriver /opt/selenium/chromedriver-$CHROME_DRIVER_VERSION \
27+
&& chmod 755 /opt/selenium/chromedriver-$CHROME_DRIVER_VERSION \
28+
&& ln -fs /opt/selenium/chromedriver-$CHROME_DRIVER_VERSION /usr/bin/chromedriver
29+
30+
#========================
31+
# Selenium Configuration
32+
#========================
33+
COPY config.json /opt/selenium/config.json
34+
35+
#=================================
36+
# Chrome Launch Script Modication
37+
#=================================
38+
COPY chrome_launcher.sh /opt/google/chrome/google-chrome
39+
RUN chmod +x /opt/google/chrome/google-chrome
40+
41+
USER seluser
File renamed without changes.
File renamed without changes.

bin/vncview

Lines changed: 0 additions & 6 deletions
This file was deleted.

build/chrome/install.sh

Lines changed: 0 additions & 43 deletions
This file was deleted.

0 commit comments

Comments
 (0)