Skip to content

Commit 0fb62d9

Browse files
committed
Optimize package installation in docker base image
- Add --no-install-recommends option in order to install only what is required - Install only gpg and gpg-agent instead of full gnupg - Replace Node setup script with just the two required commands for adding the repo. This prevents unneeded packages (full gnupg, lsb_release...) from being installed by the script - Do not install sudo as it's not required - Limit the number of RUN - Delete apt cache: rm -rf /var/lib/apt/lists/* - Update Chrome version to make the install work
1 parent f24c2d3 commit 0fb62d9

File tree

1 file changed

+24
-22
lines changed

1 file changed

+24
-22
lines changed

scraper/dev/docker/Dockerfile.base

+24-22
Original file line numberDiff line numberDiff line change
@@ -12,31 +12,35 @@ RUN chgrp -R seleuser /home/seleuser
1212

1313
WORKDIR /home/seleuser
1414

15-
RUN apt-get update -y && apt-get install -yq \
16-
software-properties-common\
17-
python3.10
18-
RUN add-apt-repository -y ppa:openjdk-r/ppa
19-
RUN apt-get update -y && apt-get install -yq \
20-
curl \
21-
wget \
22-
sudo \
23-
gnupg \
24-
&& curl -sL https://deb.nodesource.com/setup_18.x | sudo bash -
25-
RUN apt-get update -y && apt-get install -y \
26-
nodejs
27-
RUN apt-get update -y && apt-get install -yq \
28-
unzip \
29-
xvfb \
30-
libxi6 \
31-
libgconf-2-4 \
32-
default-jdk
15+
RUN apt-get update -y && \
16+
apt-get install -yq --no-install-recommends \
17+
software-properties-common \
18+
gpg \
19+
gpg-agent \
20+
python3.10 \
21+
python3-pip && \
22+
add-apt-repository -y ppa:openjdk-r/ppa && \
23+
apt-get install -yq --no-install-recommends \
24+
curl \
25+
wget \
26+
xvfb \
27+
libxi6 \
28+
libgconf-2-4 \
29+
default-jdk && \
30+
curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | gpg --dearmor > /usr/share/keyrings/nodesource.gpg && \
31+
echo 'deb [signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x jammy main' > /etc/apt/sources.list.d/nodesource.list && \
32+
apt-get update && \
33+
apt-get install -y --no-install-recommends \
34+
nodejs && \
35+
rm -rf /var/lib/apt/lists/*
3336

3437
# https://www.ubuntuupdates.org/package/google_chrome/stable/main/base/google-chrome-stable for references around the latest versions
3538
RUN curl -sS -o - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add
3639
RUN echo "deb [arch=amd64] https://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list
3740
RUN apt-get update -y && apt-get install -yq \
38-
google-chrome-stable=110.0.5481.100-1 \
39-
unzip
41+
google-chrome-stable=111.0.5563.146-1 \
42+
unzip && \
43+
rm -rf /var/lib/apt/lists/*
4044
RUN wget -q https://chromedriver.storage.googleapis.com/110.0.5481.77/chromedriver_linux64.zip
4145
RUN unzip chromedriver_linux64.zip
4246
RUN rm -f chromedriver_linux64.zip
@@ -55,8 +59,6 @@ COPY Pipfile.lock .
5559
ENV LC_ALL C.UTF-8
5660
ENV LANG C.UTF-8
5761
ENV PIPENV_HIDE_EMOJIS 1
58-
RUN apt-get update -y && apt-get install -yq \
59-
python3-pip
6062
RUN pip3 install pipenv
6163

6264
USER 1000

0 commit comments

Comments
 (0)