Skip to content

Commit 197cf5f

Browse files
committed
Update the Dockerfile
1 parent d2d2ba8 commit 197cf5f

File tree

1 file changed

+47
-26
lines changed

1 file changed

+47
-26
lines changed

Dockerfile

Lines changed: 47 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,34 @@
11
# SeleniumBase Docker Image
22
FROM ubuntu:22.04
3+
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
4+
5+
#======================
6+
# Locale Configuration
7+
#======================
8+
RUN apt-get update
9+
RUN apt-get install -y --no-install-recommends tzdata locales
10+
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen
11+
ENV LANG en_US.UTF-8
12+
ENV LANGUAGE en_US:en
13+
ENV LC_ALL en_US.UTF-8
14+
ENV TZ="America/New_York"
15+
16+
#======================
17+
# Install Common Fonts
18+
#======================
19+
RUN apt-get update
20+
RUN apt-get install -y \
21+
fonts-liberation \
22+
fonts-open-sans \
23+
fonts-mononoki \
24+
fonts-roboto \
25+
fonts-lato
326

427
#============================
528
# Install Linux Dependencies
629
#============================
7-
RUN apt-get update && apt-get install -y \
8-
fonts-liberation \
30+
RUN apt-get update
31+
RUN apt-get install -y \
932
libasound2 \
1033
libatk-bridge2.0-0 \
1134
libatk1.0-0 \
@@ -17,60 +40,57 @@ RUN apt-get update && apt-get install -y \
1740
libgtk-3-0 \
1841
libnspr4 \
1942
libnss3 \
43+
libu2f-udev \
44+
libvulkan1 \
2045
libwayland-client0 \
2146
libxcomposite1 \
2247
libxdamage1 \
2348
libxfixes3 \
2449
libxkbcommon0 \
25-
libxrandr2 \
26-
libu2f-udev \
27-
libvulkan1 \
28-
xdg-utils
50+
libxrandr2
51+
52+
#==========================
53+
# Install useful utilities
54+
#==========================
55+
RUN apt-get update
56+
RUN apt-get install -y xdg-utils
2957

3058
#=================================
3159
# Install Bash Command Line Tools
3260
#=================================
61+
RUN apt-get update
3362
RUN apt-get -qy --no-install-recommends install \
3463
curl \
3564
sudo \
3665
unzip \
3766
vim \
3867
wget \
39-
xvfb \
40-
&& rm -rf /var/lib/apt/lists/*
68+
xvfb
4169

4270
#================
4371
# Install Chrome
4472
#================
45-
RUN curl -LO https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
46-
RUN apt-get install -y ./google-chrome-stable_current_amd64.deb
73+
RUN apt-get update
74+
RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
75+
RUN dpkg -i google-chrome-stable_current_amd64.deb
76+
RUN apt-get -fy --no-install-recommends install
4777
RUN rm google-chrome-stable_current_amd64.deb
4878

4979
#================
5080
# Install Python
5181
#================
52-
RUN apt-get update -y
53-
RUN apt-get install -y python3 python3-pip python3-setuptools python3-dev
82+
RUN apt-get update
83+
RUN apt-get install -y python3 python3-pip python3-setuptools python3-dev python3-tk
5484
RUN alias python=python3
5585
RUN echo "alias python=python3" >> ~/.bashrc
5686
RUN apt-get -qy --no-install-recommends install python3.10
5787
RUN rm /usr/bin/python3
5888
RUN ln -s python3.10 /usr/bin/python3
5989

60-
#=============================================
61-
# Allow Special Characters in Python Programs
62-
#=============================================
63-
RUN export PYTHONIOENCODING=utf8
64-
RUN echo "export PYTHONIOENCODING=utf8" >> ~/.bashrc
65-
66-
#===========================
67-
# Configure Virtual Display
68-
#===========================
69-
RUN set -e
70-
RUN echo "Starting X virtual framebuffer (Xvfb) in background..."
71-
RUN Xvfb -ac :99 -screen 0 1280x1024x16 > /dev/null 2>&1 &
72-
RUN export DISPLAY=:99
73-
RUN exec "$@"
90+
#===============
91+
# Cleanup Lists
92+
#===============
93+
RUN rm -rf /var/lib/apt/lists/*
7494

7595
#=====================
7696
# Set up SeleniumBase
@@ -89,6 +109,7 @@ RUN find . -name '*.pyc' -delete
89109
RUN pip install --upgrade pip setuptools wheel
90110
RUN cd /SeleniumBase && ls && pip install -r requirements.txt --upgrade
91111
RUN cd /SeleniumBase && pip install .
112+
RUN pip install pyautogui
92113

93114
#=======================
94115
# Download chromedriver

0 commit comments

Comments
 (0)