forked from cgowez/robot-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
46 lines (44 loc) · 2.22 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
FROM debian:stretch-slim
ENV CHROMEDRIVER_VERSION 2.41
ENV GECKODRIVER_VERSION 0.20.1
ENV FIREFOXBROWSER_VERSION 60.0.1
ENV DEPS wget curl unzip
RUN apt-get update \
&& apt-get install -y $DEPS gcc python python-pip libdbus-glib-1-dev libgtk2.0-0\
## Install Chrome
&& 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 \
## Install Firefox
&& wget https://ftp.mozilla.org/pub/firefox/releases/$FIREFOXBROWSER_VERSION/linux-x86_64/en-US/firefox-$FIREFOXBROWSER_VERSION.tar.bz2 \
&& tar -xjf "firefox-$FIREFOXBROWSER_VERSION.tar.bz2" \
&& mv firefox /opt/firefox \
&& rm "firefox-$FIREFOXBROWSER_VERSION.tar.bz2" \
## Move Binaries, place headless scripts
&& echo $'#!/bin/bash\n\
chrome --headless --disable-gpu --no-sandbox $@ &\n\
chrome=$!\n\
wait $chrome' > /usr/bin/headless-chrome \
&& echo $'#!/bin/bash\n\
firefox-browser -headless $@ &\n\
ff=$!\n\
wait $ff' > /usr/bin/headless-firefox \
&& ln -s /opt/firefox/firefox /usr/bin/firefox-browser \
&& ln -s /usr/bin/headless-firefox /usr/bin/firefox \
&& mv /opt/google/chrome/google-chrome /opt/google/chrome/google-chrome-browser \
&& rm /usr/bin/google-chrome-stable \
&& rm /usr/bin/google-chrome \
&& ln -s /opt/google/chrome/google-chrome-browser /usr/bin/chrome \
&& ln -s /usr/bin/headless-chrome /usr/bin/google-chrome \
&& chmod a+x /usr/bin/headless-chrome \
&& chmod a+x /usr/bin/headless-firefox \
## Download Browser Drivers
&& curl -SLO "https://chromedriver.storage.googleapis.com/$CHROMEDRIVER_VERSION/chromedriver_linux64.zip" \
&& unzip "chromedriver_linux64.zip" -d /usr/local/bin \
&& rm "chromedriver_linux64.zip" \
&& curl -SLO "https://github.com/mozilla/geckodriver/releases/download/v$GECKODRIVER_VERSION/geckodriver-v$GECKODRIVER_VERSION-linux64.tar.gz" \
&& tar zxvf "geckodriver-v$GECKODRIVER_VERSION-linux64.tar.gz" -C /usr/local/bin \
&& rm "geckodriver-v$GECKODRIVER_VERSION-linux64.tar.gz" \
## Install robotFramework and deps
&& pip install robotframework robotframework-selenium2library robotframework-faker robotframework-pabot
WORKDIR /robot