1
1
# SeleniumBase Docker Image
2
2
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
3
26
4
27
# ============================
5
28
# Install Linux Dependencies
6
29
# ============================
7
- RUN apt-get update && apt-get install -y \
8
- fonts-liberation \
30
+ RUN apt-get update
31
+ RUN apt-get install -y \
9
32
libasound2 \
10
33
libatk-bridge2.0-0 \
11
34
libatk1.0-0 \
@@ -17,60 +40,57 @@ RUN apt-get update && apt-get install -y \
17
40
libgtk-3-0 \
18
41
libnspr4 \
19
42
libnss3 \
43
+ libu2f-udev \
44
+ libvulkan1 \
20
45
libwayland-client0 \
21
46
libxcomposite1 \
22
47
libxdamage1 \
23
48
libxfixes3 \
24
49
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
29
57
30
58
# =================================
31
59
# Install Bash Command Line Tools
32
60
# =================================
61
+ RUN apt-get update
33
62
RUN apt-get -qy --no-install-recommends install \
34
63
curl \
35
64
sudo \
36
65
unzip \
37
66
vim \
38
67
wget \
39
- xvfb \
40
- && rm -rf /var/lib/apt/lists/*
68
+ xvfb
41
69
42
70
# ================
43
71
# Install Chrome
44
72
# ================
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
47
77
RUN rm google-chrome-stable_current_amd64.deb
48
78
49
79
# ================
50
80
# Install Python
51
81
# ================
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
54
84
RUN alias python=python3
55
85
RUN echo "alias python=python3" >> ~/.bashrc
56
86
RUN apt-get -qy --no-install-recommends install python3.10
57
87
RUN rm /usr/bin/python3
58
88
RUN ln -s python3.10 /usr/bin/python3
59
89
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/*
74
94
75
95
# =====================
76
96
# Set up SeleniumBase
@@ -89,6 +109,7 @@ RUN find . -name '*.pyc' -delete
89
109
RUN pip install --upgrade pip setuptools wheel
90
110
RUN cd /SeleniumBase && ls && pip install -r requirements.txt --upgrade
91
111
RUN cd /SeleniumBase && pip install .
112
+ RUN pip install pyautogui
92
113
93
114
# =======================
94
115
# Download chromedriver
0 commit comments