Brand New Dockerfile
This commit is contained in:
parent
b382d58bd1
commit
717b8cbb1a
111
Dockerfile
111
Dockerfile
|
@ -1,40 +1,29 @@
|
|||
# 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
|
||||
|
||||
#========================
|
||||
# Miscellaneous packages
|
||||
# Includes minimal runtime used for executing selenium with firefox
|
||||
#========================
|
||||
ENV BUILD_DEPS '\
|
||||
build-essential \
|
||||
libmysqlclient-dev \
|
||||
libpython-dev \
|
||||
libyaml-dev \
|
||||
libxml2-dev \
|
||||
libxslt1-dev \
|
||||
libxslt-dev \
|
||||
zlib1g-dev \
|
||||
'
|
||||
|
||||
RUN apt-get update -qqy \
|
||||
&& apt-get -qy --no-install-recommends install \
|
||||
locales \
|
||||
language-pack-en \
|
||||
#=================================
|
||||
# Install Bash Command Line Tools
|
||||
#=================================
|
||||
RUN apt-get -qy --no-install-recommends install \
|
||||
sudo \
|
||||
unzip \
|
||||
wget \
|
||||
curl \
|
||||
vim \
|
||||
xvfb \
|
||||
libaio1 \
|
||||
libxml2 \
|
||||
libxslt1.1 \
|
||||
mysql-client \
|
||||
${BUILD_DEPS} \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
&& 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
|
||||
|
@ -44,19 +33,16 @@ ENV LANG ${LANGUAGE}
|
|||
RUN locale-gen ${LANGUAGE} \
|
||||
&& dpkg-reconfigure --frontend noninteractive locales
|
||||
|
||||
#====================
|
||||
# Firefox Latest ESR
|
||||
#====================
|
||||
RUN apt-get update -qqy \
|
||||
&& 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 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
|
||||
|
@ -67,22 +53,25 @@ RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key
|
|||
&& apt-get install -y google-chrome-stable \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
#===================
|
||||
# Timezone settings
|
||||
#===================
|
||||
# Full list at http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
|
||||
# e.g. "US/Pacific" for Los Angeles, California, USA
|
||||
ENV TZ "America/New_York"
|
||||
# Apply TimeZone
|
||||
RUN echo $TZ | tee /etc/timezone \
|
||||
&& dpkg-reconfigure --frontend noninteractive tzdata
|
||||
#==================
|
||||
# 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
|
||||
|
||||
#========================================
|
||||
# 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
|
||||
#=================
|
||||
# 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
|
||||
|
@ -93,6 +82,15 @@ RUN ln -s /usr/local/share/phantomjs-1.9.7-linux-x86_64/bin/phantomjs /usr/local
|
|||
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
|
||||
#=====================
|
||||
|
@ -103,13 +101,12 @@ COPY examples /SeleniumBase/examples/
|
|||
RUN cd /SeleniumBase && ls && sudo pip install -r docker_requirements.txt
|
||||
RUN cd /SeleniumBase && ls && sudo python docker_setup.py install
|
||||
|
||||
#=========================================
|
||||
# Create entrypoint and grab example test
|
||||
#=========================================
|
||||
#==========================================
|
||||
# Create entrypoint and grab example tests
|
||||
#==========================================
|
||||
COPY docker/docker-entrypoint.sh /
|
||||
COPY docker/run_docker_test_in_firefox.sh /
|
||||
COPY docker/run_docker_test_in_chrome.sh /
|
||||
COPY docker/run_docker_test_in_phantomjs.sh /
|
||||
COPY docker/docker_config.cfg /SeleniumBase/examples/
|
||||
ENTRYPOINT ["/docker-entrypoint.sh"]
|
||||
CMD ["/bin/bash"]
|
||||
|
|
Loading…
Reference in New Issue