110 lines
4.2 KiB
Docker
Executable File
110 lines
4.2 KiB
Docker
Executable File
# SeleniumBase Docker Image
|
|
FROM ubuntu:14.04
|
|
|
|
#=======================================
|
|
# Install Python and Basic Python Tools
|
|
#=======================================
|
|
RUN apt-get update && apt-get install -y python python-pip python-setuptools python-dev python-distribute
|
|
|
|
#=================================
|
|
# Install Bash Command Line Tools
|
|
#=================================
|
|
RUN apt-get -qy --no-install-recommends install \
|
|
sudo \
|
|
unzip \
|
|
wget \
|
|
curl \
|
|
vim \
|
|
xvfb \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
#========================================
|
|
# Add normal user with passwordless sudo
|
|
#========================================
|
|
RUN sudo useradd seluser --shell /bin/bash --create-home \
|
|
&& sudo usermod -a -G sudo seluser \
|
|
&& echo 'ALL ALL = (ALL) NOPASSWD: ALL' >> /etc/sudoers
|
|
|
|
#==============================
|
|
# Locale and encoding settings
|
|
#==============================
|
|
ENV LANGUAGE en_US.UTF-8
|
|
ENV LANG ${LANGUAGE}
|
|
RUN locale-gen ${LANGUAGE} \
|
|
&& dpkg-reconfigure --frontend noninteractive locales
|
|
|
|
#======================
|
|
# Install Chromedriver
|
|
#======================
|
|
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
|
|
|
|
#================
|
|
# Install 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.list \
|
|
&& apt-get update \
|
|
&& apt-get install -y google-chrome-stable \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
#==================
|
|
# Configure Chrome
|
|
#==================
|
|
RUN dpkg-divert --add --rename --divert /opt/google/chrome/google-chrome.real /opt/google/chrome/google-chrome && \
|
|
echo "#!/bin/bash\nexec /opt/google/chrome/google-chrome.real --disable-setuid-sandbox \"\$@\"" > /opt/google/chrome/google-chrome && \
|
|
chmod 755 /opt/google/chrome/google-chrome
|
|
|
|
#=================
|
|
# Install Firefox
|
|
#=================
|
|
RUN apt-get -qy --no-install-recommends install \
|
|
$(apt-cache depends firefox | grep Depends | sed "s/.*ends:\ //" | tr '\n' ' ') \
|
|
&& rm -rf /var/lib/apt/lists/* \
|
|
&& cd /tmp \
|
|
&& wget --no-check-certificate -O firefox-esr.tar.bz2 \
|
|
'https://download.mozilla.org/?product=firefox-esr-latest&os=linux64&lang=en-US' \
|
|
&& tar -xjf firefox-esr.tar.bz2 -C /opt/ \
|
|
&& ln -s /opt/firefox/firefox /usr/bin/firefox \
|
|
&& rm -f /tmp/firefox-esr.tar.bz2
|
|
|
|
#===================
|
|
# Install PhantomJS
|
|
#===================
|
|
RUN cd /usr/local/share && wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.7-linux-x86_64.tar.bz2
|
|
RUN cd /usr/local/share && tar xjf phantomjs-1.9.7-linux-x86_64.tar.bz2
|
|
RUN ln -s /usr/local/share/phantomjs-1.9.7-linux-x86_64/bin/phantomjs /usr/local/share/phantomjs
|
|
RUN ln -s /usr/local/share/phantomjs-1.9.7-linux-x86_64/bin/phantomjs /usr/local/bin/phantomjs
|
|
RUN ln -s /usr/local/share/phantomjs-1.9.7-linux-x86_64/bin/phantomjs /usr/bin/phantomjs
|
|
|
|
#===========================
|
|
# Configure Virtual Display
|
|
#===========================
|
|
RUN set -e
|
|
RUN echo "Starting X virtual framebuffer (Xvfb) in background..."
|
|
RUN Xvfb -ac :99 -screen 0 1280x1024x16 > /dev/null 2>&1 &
|
|
RUN export DISPLAY=:99
|
|
RUN exec "$@"
|
|
|
|
#=====================
|
|
# Set up SeleniumBase
|
|
#=====================
|
|
COPY seleniumbase /SeleniumBase/seleniumbase/
|
|
COPY examples /SeleniumBase/examples/
|
|
RUN cd /SeleniumBase && ls && pip install seleniumbase
|
|
|
|
#==========================================
|
|
# Create entrypoint and grab example tests
|
|
#==========================================
|
|
COPY integrations/docker/docker-entrypoint.sh /
|
|
COPY integrations/docker/run_docker_test_in_firefox.sh /
|
|
COPY integrations/docker/run_docker_test_in_chrome.sh /
|
|
COPY integrations/docker/docker_config.cfg /SeleniumBase/examples/
|
|
ENTRYPOINT ["/docker-entrypoint.sh"]
|
|
CMD ["/bin/bash"]
|