Skip to content

Commit b9f0d70

Browse files
committed
Docker: Unified the env var from Base
Signed-off-by: Viet Nguyen Duc <nguyenducviet4496@gmail.com>
1 parent e32ae9c commit b9f0d70

File tree

6 files changed

+29
-15
lines changed

6 files changed

+29
-15
lines changed

Base/Dockerfile

+4-3
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ ENV DEBIAN_FRONTEND=noninteractive \
3636
HOME=${HOME} \
3737
TZ=${TZ} \
3838
SEL_DOWNLOAD_DIR=${HOME}/Downloads \
39-
VIDEO_FOLDER="/videos"
39+
VIDEO_FOLDER="/videos" \
40+
# Path to the Configfile
41+
CONFIG_FILE="/opt/selenium/config.toml"
4042

4143
#========================
4244
# Miscellaneous packages
@@ -100,7 +102,7 @@ RUN --mount=type=secret,id=SEL_PASSWD \
100102
${HOME}/.mozilla ${HOME}/.vnc ${HOME}/.pki/nssdb ${VIDEO_FOLDER} \
101103
# NSSDB initialization with an empty password
102104
&& certutil -d sql:${HOME}/.pki/nssdb -N --empty-password \
103-
&& touch /opt/selenium/config.toml \
105+
&& touch ${CONFIG_FILE} \
104106
&& chown -R ${SEL_USER}:${SEL_GROUP} /opt/selenium /var/run/supervisor /var/log/supervisor /etc/passwd ${HOME} ${VIDEO_FOLDER} \
105107
&& chmod -R 775 /opt/selenium /var/run/supervisor /var/log/supervisor /etc/passwd ${HOME} ${VIDEO_FOLDER} \
106108
&& wget --no-verbose https://github.com/${AUTHORS}/selenium/releases/download/${RELEASE}/selenium-server-${VERSION}.jar \
@@ -171,7 +173,6 @@ RUN /opt/bin/add-jks-helper.sh -d /opt/selenium/secrets \
171173
# Boolean value, maps "--bind-host"
172174
ENV SE_BIND_HOST="false" \
173175
SE_SERVER_PROTOCOL="http" \
174-
CONFIG_FILE="/opt/selenium/config.toml" \
175176
# Boolean value, maps "--reject-unsupported-caps"
176177
SE_REJECT_UNSUPPORTED_CAPS="false" \
177178
SE_OTEL_JAVA_GLOBAL_AUTOCONFIGURE_ENABLED="true" \

NodeBase/Dockerfile

-2
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ ENV LANG_WHICH=${LANG_WHICH} \
6565
SE_VNC_PORT="5900" \
6666
DISPLAY=":99.0" \
6767
DISPLAY_NUM="99" \
68-
# Path to the Configfile
69-
CONFIG_FILE="/opt/selenium/config.toml" \
7068
GENERATE_CONFIG="true" \
7169
# Following line fixes https://github.com/SeleniumHQ/docker-selenium/issues/87
7270
DBUS_SESSION_BUS_ADDRESS="/dev/null"

NodeDocker/start-selenium-grid-docker.sh

+12-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
# set -e: exit asap if a command exits with a non-zero status
44
set -e
55

6-
echo "Starting Selenium Grid Node Docker..."
7-
86
function append_se_opts() {
97
local option="${1}"
108
local value="${2:-""}"
@@ -89,6 +87,18 @@ if [ "${SE_ENABLE_TLS}" = "true" ]; then
8987
fi
9088
fi
9189

90+
if [ ! -z "${SE_NODE_DOCKER_CONFIG_FILENAME}" ]; then
91+
CONFIG_FILE="/opt/selenium/${SE_NODE_DOCKER_CONFIG_FILENAME}"
92+
fi
93+
94+
if [ ! -z "${CONFIG_FILE}" ]; then
95+
append_se_opts "--config" "${CONFIG_FILE}"
96+
fi
97+
98+
echo "Selenium Grid Node Docker configuration: "
99+
cat "${CONFIG_FILE}"
100+
echo "Starting Selenium Grid Node Docker..."
101+
92102
EXTRA_LIBS=""
93103

94104
if [ "${SE_ENABLE_TRACING}" = "true" ] && [ -n "${SE_OTEL_EXPORTER_ENDPOINT}" ]; then
@@ -143,7 +153,6 @@ java ${JAVA_OPTS:-$SE_JAVA_OPTS} \
143153
--subscribe-events tcp://"${SE_EVENT_BUS_HOST}":${SE_EVENT_BUS_SUBSCRIBE_PORT} \
144154
--bind-host ${SE_BIND_HOST} \
145155
--detect-drivers false \
146-
--config /opt/selenium/${SE_NODE_DOCKER_CONFIG_FILENAME:-"config.toml"} \
147156
${SE_GRID_URL} ${SE_OPTS} &
148157

149158
SELENIUM_SERVER_PID=$!

Sessions/Dockerfile

-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,5 @@ USER ${SEL_UID}
2121
EXPOSE 5556
2222

2323
ENV SE_OTEL_SERVICE_NAME="selenium-session-map" \
24-
# Path to the Configfile
25-
CONFIG_FILE="/opt/selenium/config.toml" \
2624
GENERATE_CONFIG="true" \
2725
SE_SESSIONS_MAP_EXTERNAL_DATASTORE="false"

Standalone/start-selenium-standalone.sh

+5-2
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,12 @@ fi
124124
/opt/bin/generate_config
125125
/opt/bin/generate_relay_config
126126

127+
if [ ! -z "${CONFIG_FILE}" ]; then
128+
append_se_opts "--config" "${CONFIG_FILE}"
129+
fi
130+
127131
echo "Selenium Grid Standalone configuration: "
128-
cat /opt/selenium/config.toml
132+
cat "${CONFIG_FILE}"
129133
echo "Starting Selenium Grid Standalone..."
130134

131135
EXTRA_LIBS=""
@@ -191,7 +195,6 @@ java ${JAVA_OPTS:-$SE_JAVA_OPTS} \
191195
--relax-checks ${SE_RELAX_CHECKS} \
192196
--detect-drivers false \
193197
--bind-host ${SE_BIND_HOST} \
194-
--config /opt/selenium/config.toml \
195198
${SUB_PATH_CONFIG} \
196199
${SE_OPTS} &
197200

StandaloneDocker/start-selenium-grid-docker.sh

+8-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
# set -e: exit asap if a command exits with a non-zero status
44
set -e
55

6-
echo "Starting Selenium Grid Standalone Docker..."
7-
86
function append_se_opts() {
97
local option="${1}"
108
local value="${2:-""}"
@@ -94,6 +92,14 @@ if [ "${SE_ENABLE_TLS}" = "true" ]; then
9492
fi
9593
fi
9694

95+
if [ ! -z "${CONFIG_FILE}" ]; then
96+
append_se_opts "--config" "${CONFIG_FILE}"
97+
fi
98+
99+
echo "Selenium Grid Standalone Docker configuration: "
100+
cat "${CONFIG_FILE}"
101+
echo "Starting Selenium Grid Standalone Docker..."
102+
97103
EXTRA_LIBS=""
98104

99105
if [ "${SE_ENABLE_TRACING}" = "true" ] && [ -n "${SE_OTEL_EXPORTER_ENDPOINT}" ]; then
@@ -149,7 +155,6 @@ java ${JAVA_OPTS:-$SE_JAVA_OPTS} \
149155
--relax-checks ${SE_RELAX_CHECKS} \
150156
--detect-drivers false \
151157
--bind-host ${SE_BIND_HOST} \
152-
--config /opt/selenium/config.toml \
153158
${SE_GRID_URL} ${SE_OPTS} &
154159

155160
SELENIUM_SERVER_PID=$!

0 commit comments

Comments
 (0)