diff --git a/Hub/Dockerfile.txt b/Hub/Dockerfile.txt new file mode 100644 index 000000000..2950a2022 --- /dev/null +++ b/Hub/Dockerfile.txt @@ -0,0 +1,25 @@ +MAINTAINER Selenium + +#======================== +# Selenium Configuration +#======================== + +EXPOSE 4444 + +ENV GRID_NEW_SESSION_WAIT_TIMEOUT -1 +ENV GRID_JETTY_MAX_THREADS -1 +ENV GRID_NODE_POLLING 5000 +ENV GRID_CLEAN_UP_CYCLE 5000 +ENV GRID_TIMEOUT 30000 +ENV GRID_BROWSER_TIMEOUT 0 +ENV GRID_MAX_SESSION 5 +ENV GRID_UNREGISTER_IF_STILL_DOWN_AFTER 30000 + +COPY generate_config /opt/selenium/generate_config +COPY entry_point.sh /opt/bin/entry_point.sh +RUN chown -R seluser /opt/selenium + +USER seluser + +CMD ["/opt/bin/entry_point.sh"] + diff --git a/Hub/generate.sh b/Hub/generate.sh new file mode 100755 index 000000000..19987b512 --- /dev/null +++ b/Hub/generate.sh @@ -0,0 +1,5 @@ +#!/bin/bash +VERSION=$1 + +echo FROM selenium/base:$VERSION > ./Dockerfile +cat ./Dockerfile.txt >> ./Dockerfile diff --git a/Makefile b/Makefile index 58d5ad397..44fa51d88 100644 --- a/Makefile +++ b/Makefile @@ -11,16 +11,28 @@ ci: build test base: cd ./Base && docker build -t $(NAME)/base:$(VERSION) . -hub: base +generate_hub: + cd ./Hub && ./generate.sh $(VERSION) + +hub: base generate_hub cd ./Hub && docker build -t $(NAME)/hub:$(VERSION) . -nodebase: base +generate_nodebase: + cd ./NodeBase && ./generate.sh $(VERSION) + +nodebase: base generate_nodebase cd ./NodeBase && docker build -t $(NAME)/node-base:$(VERSION) . -chrome: nodebase +generate_chrome: + cd ./NodeChrome && ./generate.sh $(VERSION) + +chrome: nodebase generate_chrome cd ./NodeChrome && docker build -t $(NAME)/node-chrome:$(VERSION) . -firefox: nodebase +generate_firefox: + cd ./NodeFirefox && ./generate.sh $(VERSION) + +firefox: nodebase generate_firefox cd ./NodeFirefox && docker build -t $(NAME)/node-firefox:$(VERSION) . generate_standalone_firefox: diff --git a/NodeBase/Dockerfile.txt b/NodeBase/Dockerfile.txt new file mode 100644 index 000000000..424b3a65a --- /dev/null +++ b/NodeBase/Dockerfile.txt @@ -0,0 +1,38 @@ +MAINTAINER Selenium + +ENV DEBIAN_FRONTEND noninteractive +ENV DEBCONF_NONINTERACTIVE_SEEN true + +#=================== +# Timezone settings +# Possible alternative: https://github.com/docker/docker/issues/3359#issuecomment-32150214 +#=================== +ENV TZ "US/Pacific" +RUN echo "US/Pacific" | sudo tee /etc/timezone \ + && dpkg-reconfigure --frontend noninteractive tzdata + +#============== +# VNC and Xvfb +#============== +RUN apt-get update -qqy \ + && apt-get -qqy install \ + xvfb \ + && rm -rf /var/lib/apt/lists/* + +#============================== +# Scripts to run Selenium Node +#============================== +COPY entry_point.sh /opt/bin/entry_point.sh +RUN chmod +x /opt/bin/entry_point.sh + +#============================ +# Some configuration options +#============================ +ENV SCREEN_WIDTH 1360 +ENV SCREEN_HEIGHT 1020 +ENV SCREEN_DEPTH 24 +ENV DISPLAY :99.0 + +USER seluser + +CMD ["/opt/bin/entry_point.sh"] diff --git a/NodeBase/generate.sh b/NodeBase/generate.sh new file mode 100755 index 000000000..19987b512 --- /dev/null +++ b/NodeBase/generate.sh @@ -0,0 +1,5 @@ +#!/bin/bash +VERSION=$1 + +echo FROM selenium/base:$VERSION > ./Dockerfile +cat ./Dockerfile.txt >> ./Dockerfile diff --git a/NodeChrome/Dockerfile.txt b/NodeChrome/Dockerfile.txt new file mode 100644 index 000000000..38d854a3e --- /dev/null +++ b/NodeChrome/Dockerfile.txt @@ -0,0 +1,39 @@ +MAINTAINER Selenium + +USER root + +#=============== +# Google Chrome +#=============== +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 \ + google-chrome-stable \ + && rm /etc/apt/sources.list.d/google-chrome.list \ + && rm -rf /var/lib/apt/lists/* + +#================== +# Chrome webdriver +#================== +ENV CHROME_DRIVER_VERSION 2.15 +RUN wget --no-verbose -O /tmp/chromedriver_linux64.zip http://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 + +#======================== +# Selenium Configuration +#======================== +COPY config.json /opt/selenium/config.json + +#================================= +# Chrome Launch Script Modication +#================================= +COPY chrome_launcher.sh /opt/google/chrome/google-chrome +RUN chmod +x /opt/google/chrome/google-chrome + +USER seluser diff --git a/NodeChrome/generate.sh b/NodeChrome/generate.sh new file mode 100755 index 000000000..fa4e399df --- /dev/null +++ b/NodeChrome/generate.sh @@ -0,0 +1,5 @@ +#!/bin/bash +VERSION=$1 + +echo FROM selenium/node-base:$VERSION > ./Dockerfile +cat ./Dockerfile.txt >> ./Dockerfile diff --git a/NodeFirefox/Dockerfile.txt b/NodeFirefox/Dockerfile.txt new file mode 100644 index 000000000..d776ccb9a --- /dev/null +++ b/NodeFirefox/Dockerfile.txt @@ -0,0 +1,18 @@ +MAINTAINER Selenium + +USER root + +#========= +# Firefox +#========= +RUN apt-get update -qqy \ + && apt-get -qqy --no-install-recommends install \ + firefox \ + && rm -rf /var/lib/apt/lists/* + +#======================== +# Selenium Configuration +#======================== +COPY config.json /opt/selenium/config.json + +USER seluser diff --git a/NodeFirefox/generate.sh b/NodeFirefox/generate.sh new file mode 100755 index 000000000..fa4e399df --- /dev/null +++ b/NodeFirefox/generate.sh @@ -0,0 +1,5 @@ +#!/bin/bash +VERSION=$1 + +echo FROM selenium/node-base:$VERSION > ./Dockerfile +cat ./Dockerfile.txt >> ./Dockerfile