/
Dockerfile
165 lines (142 loc) · 4.4 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# NOTE: DO *NOT* EDIT THIS FILE. IT IS GENERATED.
# PLEASE UPDATE Dockerfile.txt INSTEAD OF THIS FILE
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
FROM selenium/base:4.0.0-beta-1-prerelease-20210207
LABEL authors=SeleniumHQ
USER root
#==============
# Xvfb
#==============
RUN apt-get update -qqy \
&& apt-get -qqy install \
xvfb \
pulseaudio \
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*
#==============================
# Locale and encoding settings
#==============================
ENV LANG_WHICH en
ENV LANG_WHERE US
ENV ENCODING UTF-8
ENV LANGUAGE ${LANG_WHICH}_${LANG_WHERE}.${ENCODING}
ENV LANG ${LANGUAGE}
# Layer size: small: ~9 MB
# Layer size: small: ~9 MB MB (with --no-install-recommends)
RUN apt-get -qqy update \
&& apt-get -qqy --no-install-recommends install \
language-pack-en \
tzdata \
locales \
&& locale-gen ${LANGUAGE} \
&& dpkg-reconfigure --frontend noninteractive locales \
&& apt-get -qyy autoremove \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get -qyy clean
#=====
# VNC
#=====
RUN apt-get update -qqy \
&& apt-get -qqy install \
x11vnc \
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*
#=========
# fluxbox
# A fast, lightweight and responsive window manager
#=========
RUN apt-get update -qqy \
&& apt-get -qqy install \
fluxbox \
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*
#================
# Font libraries
#================
# libfontconfig ~1 MB
# libfreetype6 ~1 MB
# xfonts-cyrillic ~2 MB
# xfonts-scalable ~2 MB
# fonts-liberation ~3 MB
# fonts-ipafont-gothic ~13 MB
# fonts-wqy-zenhei ~17 MB
# fonts-tlwg-loma-otf ~300 KB
# ttf-ubuntu-font-family ~5 MB
# Ubuntu Font Family, sans-serif typeface hinted for clarity
# Removed packages:
# xfonts-100dpi ~6 MB
# xfonts-75dpi ~6 MB
# Regarding fonts-liberation see:
# https://github.com/SeleniumHQ/docker-selenium/issues/383#issuecomment-278367069
# Layer size: small: 36.28 MB (with --no-install-recommends)
# Layer size: small: 36.28 MB
RUN apt-get -qqy update \
&& apt-get -qqy --no-install-recommends install \
libfontconfig \
libfreetype6 \
xfonts-cyrillic \
xfonts-scalable \
fonts-liberation \
fonts-ipafont-gothic \
fonts-wqy-zenhei \
fonts-tlwg-loma-otf \
ttf-ubuntu-font-family \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get -qyy clean
#===================================================
# Run the following commands as non-privileged user
#===================================================
USER 1200
#==============================
# Scripts to run Selenium Node and XVFB
#==============================
COPY start-selenium-node.sh \
start-xvfb.sh \
/opt/bin/
#==============================
# Supervisor configuration file
#==============================
COPY selenium.conf /etc/supervisor/conf.d/
#==============================
# Generating the VNC password as seluser
# So the service can be started with seluser
#==============================
RUN mkdir -p ${HOME}/.vnc \
&& x11vnc -storepasswd secret ${HOME}/.vnc/passwd
#==========
# Relaxing permissions for OpenShift and other non-sudo environments
#==========
RUN sudo chmod -R 777 ${HOME} \
&& sudo chgrp -R 0 ${HOME} \
&& sudo chmod -R g=u ${HOME}
#==============================
# Scripts to run fluxbox and x11vnc
#==============================
COPY start-vnc.sh \
/opt/bin/
#==============================
# Selenium Grid logo as wallpaper for Fluxbox
#==============================
COPY selenium_grid_logo.png /usr/share/images/fluxbox/ubuntu-light.png
#============================
# Some configuration options
#============================
ENV SCREEN_WIDTH 1360
ENV SCREEN_HEIGHT 1020
ENV SCREEN_DEPTH 24
ENV SCREEN_DPI 96
ENV DISPLAY :99.0
ENV DISPLAY_NUM 99
ENV START_XVFB true
#========================
# Selenium Configuration
#========================
# As integer, maps to "max-concurrent-sessions"
ENV SE_NODE_MAX_CONCURRENT_SESSIONS 1
# Following line fixes https://github.com/SeleniumHQ/docker-selenium/issues/87
ENV DBUS_SESSION_BUS_ADDRESS=/dev/null
# Creating base directory for Xvfb
RUN sudo mkdir -p /tmp/.X11-unix && sudo chmod 1777 /tmp/.X11-unix
# Copying configuration script generator
COPY generate_config /opt/bin/generate_config
# Generating a default config during build time
RUN /opt/bin/generate_config
EXPOSE 5900