|
1 | 1 | FROM ubuntu:focal
|
2 | 2 |
|
3 | 3 | ARG DEBIAN_FRONTEND=noninteractive
|
4 |
| -RUN apt-get update && apt-get install --no-install-recommends -y \ |
5 |
| - python3 python3-pip \ |
| 4 | +RUN echo "===> Installing system dependencies..." && \ |
| 5 | + BUILD_DEPS="curl unzip" && \ |
| 6 | + apt-get update && apt-get install --no-install-recommends -y \ |
| 7 | + python3 python3-pip wget \ |
6 | 8 | fonts-liberation libappindicator3-1 libasound2 libatk-bridge2.0-0 \
|
7 | 9 | libnspr4 libnss3 lsb-release xdg-utils libxss1 libdbus-glib-1-2 libgbm1 \
|
8 |
| - curl unzip wget \ |
9 |
| - xvfb |
10 |
| - |
11 |
| - |
12 |
| -# install geckodriver and firefox |
13 |
| - |
14 |
| -RUN GECKODRIVER_VERSION=`curl https://github.com/mozilla/geckodriver/releases/latest | grep -Po 'v[0-9]+.[0-9]+.[0-9]+'` && \ |
| 10 | + $BUILD_DEPS \ |
| 11 | + xvfb && \ |
| 12 | + \ |
| 13 | + \ |
| 14 | + echo "===> Installing geckodriver and firefox..." && \ |
| 15 | + GECKODRIVER_VERSION=`curl https://github.com/mozilla/geckodriver/releases/latest | grep -Po 'v[0-9]+.[0-9]+.[0-9]+'` && \ |
15 | 16 | wget https://github.com/mozilla/geckodriver/releases/download/$GECKODRIVER_VERSION/geckodriver-$GECKODRIVER_VERSION-linux64.tar.gz && \
|
16 | 17 | tar -zxf geckodriver-$GECKODRIVER_VERSION-linux64.tar.gz -C /usr/local/bin && \
|
17 | 18 | chmod +x /usr/local/bin/geckodriver && \
|
18 |
| - rm geckodriver-$GECKODRIVER_VERSION-linux64.tar.gz |
19 |
| - |
20 |
| -RUN FIREFOX_SETUP=firefox-setup.tar.bz2 && \ |
| 19 | + rm geckodriver-$GECKODRIVER_VERSION-linux64.tar.gz && \ |
| 20 | + \ |
| 21 | + FIREFOX_SETUP=firefox-setup.tar.bz2 && \ |
21 | 22 | apt-get purge firefox && \
|
22 | 23 | wget -O $FIREFOX_SETUP "https://download.mozilla.org/?product=firefox-latest&os=linux64" && \
|
23 | 24 | tar xjf $FIREFOX_SETUP -C /opt/ && \
|
24 | 25 | ln -s /opt/firefox/firefox /usr/bin/firefox && \
|
25 |
| - rm $FIREFOX_SETUP |
26 |
| - |
27 |
| - |
28 |
| -# install chromedriver and google-chrome |
29 |
| - |
30 |
| -RUN CHROMEDRIVER_VERSION=`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE` && \ |
| 26 | + rm $FIREFOX_SETUP && \ |
| 27 | + \ |
| 28 | + \ |
| 29 | + echo "===> Installing chromedriver and google-chrome..." && \ |
| 30 | + CHROMEDRIVER_VERSION=`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE` && \ |
31 | 31 | wget https://chromedriver.storage.googleapis.com/$CHROMEDRIVER_VERSION/chromedriver_linux64.zip && \
|
32 | 32 | unzip chromedriver_linux64.zip -d /usr/bin && \
|
33 | 33 | chmod +x /usr/bin/chromedriver && \
|
34 |
| - rm chromedriver_linux64.zip |
35 |
| - |
36 |
| -RUN CHROME_SETUP=google-chrome.deb && \ |
| 34 | + rm chromedriver_linux64.zip && \ |
| 35 | + \ |
| 36 | + CHROME_SETUP=google-chrome.deb && \ |
37 | 37 | wget -O $CHROME_SETUP "https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb" && \
|
38 | 38 | dpkg -i $CHROME_SETUP && \
|
39 | 39 | apt-get install -y -f && \
|
40 |
| - rm $CHROME_SETUP |
41 |
| - |
42 |
| - |
43 |
| -# install phantomjs |
44 |
| - |
45 |
| -RUN wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2 && \ |
| 40 | + rm $CHROME_SETUP && \ |
| 41 | + \ |
| 42 | + \ |
| 43 | + echo "===> Installing phantomjs..." && \ |
| 44 | + wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2 && \ |
46 | 45 | tar -jxf phantomjs-2.1.1-linux-x86_64.tar.bz2 && \
|
47 | 46 | cp phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/local/bin/phantomjs && \
|
48 |
| - rm phantomjs-2.1.1-linux-x86_64.tar.bz2 |
49 |
| - |
| 47 | + rm phantomjs-2.1.1-linux-x86_64.tar.bz2 && \ |
| 48 | + \ |
| 49 | + \ |
| 50 | + echo "===> Installing python dependencies..." && \ |
| 51 | + pip3 install selenium==3.141.0 pyvirtualdisplay==2.2 && \ |
| 52 | + \ |
| 53 | + \ |
| 54 | + echo "===> Remove build dependencies..." && \ |
| 55 | + apt-get remove -y $BUILD_DEPS && rm -rf /var/lib/apt/lists/* |
50 | 56 |
|
51 |
| -RUN pip3 install selenium==3.141.0 pyvirtualdisplay==2.2 |
52 | 57 |
|
53 | 58 | ENV LANG C.UTF-8
|
54 | 59 | ENV LC_ALL C.UTF-8
|
|
0 commit comments