/
Dockerfile.txt
178 lines (157 loc) · 5.15 KB
/
Dockerfile.txt
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
166
167
168
169
170
171
172
173
174
175
176
177
178
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
########################################
# noVNC exposes VNC through a web page #
########################################
# Download https://github.com/novnc/noVNC dated 2021-03-30 commit 84f102d6a9ffaf3972693d59bad5c6fddb6d7fb0
# Download https://github.com/novnc/websockify dated 2021-03-22 commit c5d365dd1dbfee89881f1c1c02a2ac64838d645f
ENV NOVNC_SHA="84f102d6a9ffaf3972693d59bad5c6fddb6d7fb0" \
WEBSOCKIFY_SHA="c5d365dd1dbfee89881f1c1c02a2ac64838d645f"
RUN wget -nv -O noVNC.zip \
"https://github.com/novnc/noVNC/archive/${NOVNC_SHA}.zip" \
&& unzip -x noVNC.zip \
&& mv noVNC-${NOVNC_SHA} /opt/bin/noVNC \
&& cp /opt/bin/noVNC/vnc.html /opt/bin/noVNC/index.html \
&& rm noVNC.zip \
&& wget -nv -O websockify.zip \
"https://github.com/novnc/websockify/archive/${WEBSOCKIFY_SHA}.zip" \
&& unzip -x websockify.zip \
&& rm websockify.zip \
&& mv websockify-${WEBSOCKIFY_SHA} /opt/bin/noVNC/utils/websockify
#===================================================
# 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, x11vnc and noVNC
#==============================
COPY start-vnc.sh \
start-novnc.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_SESSIONS 1
# As integer, maps to "session-timeout" in seconds
ENV SE_NODE_SESSION_TIMEOUT 300
# As boolean, maps to "override-max-sessions"
ENV SE_NODE_OVERRIDE_MAX_SESSIONS false
# 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
EXPOSE 5900