Skip to content

Commit 64bc0f6

Browse files
committed
Merge pull request #9 from dimmg/reduce_image_size
reduce size of the build image
2 parents fb30826 + 7d87012 commit 64bc0f6

File tree

1 file changed

+35
-30
lines changed

1 file changed

+35
-30
lines changed

Dockerfile

+35-30
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,59 @@
11
FROM ubuntu:focal
22

33
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 \
68
fonts-liberation libappindicator3-1 libasound2 libatk-bridge2.0-0 \
79
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]+'` && \
1516
wget https://github.com/mozilla/geckodriver/releases/download/$GECKODRIVER_VERSION/geckodriver-$GECKODRIVER_VERSION-linux64.tar.gz && \
1617
tar -zxf geckodriver-$GECKODRIVER_VERSION-linux64.tar.gz -C /usr/local/bin && \
1718
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 && \
2122
apt-get purge firefox && \
2223
wget -O $FIREFOX_SETUP "https://download.mozilla.org/?product=firefox-latest&os=linux64" && \
2324
tar xjf $FIREFOX_SETUP -C /opt/ && \
2425
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` && \
3131
wget https://chromedriver.storage.googleapis.com/$CHROMEDRIVER_VERSION/chromedriver_linux64.zip && \
3232
unzip chromedriver_linux64.zip -d /usr/bin && \
3333
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 && \
3737
wget -O $CHROME_SETUP "https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb" && \
3838
dpkg -i $CHROME_SETUP && \
3939
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 && \
4645
tar -jxf phantomjs-2.1.1-linux-x86_64.tar.bz2 && \
4746
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/*
5056

51-
RUN pip3 install selenium==3.141.0 pyvirtualdisplay==2.2
5257

5358
ENV LANG C.UTF-8
5459
ENV LC_ALL C.UTF-8

0 commit comments

Comments
 (0)