Skip to content

Commit 758e133

Browse files
authored
Docker: Unified the env var $CONFIG_FILE from Base (#2577)
Signed-off-by: Viet Nguyen Duc <[email protected]>
1 parent 6423b48 commit 758e133

File tree

6 files changed

+18
-11
lines changed

6 files changed

+18
-11
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

+8-1
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,13 @@ if [ "${SE_ENABLE_TLS}" = "true" ]; then
8989
fi
9090
fi
9191

92+
if [ ! -z "${SE_NODE_DOCKER_CONFIG_FILENAME}" ]; then
93+
CONFIG_FILE="/opt/selenium/${SE_NODE_DOCKER_CONFIG_FILENAME}"
94+
fi
95+
96+
echo "Selenium Grid Node Docker configuration: "
97+
cat "${CONFIG_FILE}"
98+
9299
EXTRA_LIBS=""
93100

94101
if [ "${SE_ENABLE_TRACING}" = "true" ] && [ -n "${SE_OTEL_EXPORTER_ENDPOINT}" ]; then
@@ -143,7 +150,7 @@ java ${JAVA_OPTS:-$SE_JAVA_OPTS} \
143150
--subscribe-events tcp://"${SE_EVENT_BUS_HOST}":${SE_EVENT_BUS_SUBSCRIBE_PORT} \
144151
--bind-host ${SE_BIND_HOST} \
145152
--detect-drivers false \
146-
--config /opt/selenium/${SE_NODE_DOCKER_CONFIG_FILENAME:-"config.toml"} \
153+
--config ${CONFIG_FILE} \
147154
${SE_GRID_URL} ${SE_OPTS} &
148155

149156
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

+2-2
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ fi
125125
/opt/bin/generate_relay_config
126126

127127
echo "Selenium Grid Standalone configuration: "
128-
cat /opt/selenium/config.toml
128+
cat "${CONFIG_FILE}"
129129
echo "Starting Selenium Grid Standalone..."
130130

131131
EXTRA_LIBS=""
@@ -191,7 +191,7 @@ java ${JAVA_OPTS:-$SE_JAVA_OPTS} \
191191
--relax-checks ${SE_RELAX_CHECKS} \
192192
--detect-drivers false \
193193
--bind-host ${SE_BIND_HOST} \
194-
--config /opt/selenium/config.toml \
194+
--config ${CONFIG_FILE} \
195195
${SUB_PATH_CONFIG} \
196196
${SE_OPTS} &
197197

StandaloneDocker/start-selenium-grid-docker.sh

+4-1
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ if [ "${SE_ENABLE_TLS}" = "true" ]; then
9494
fi
9595
fi
9696

97+
echo "Selenium Grid Standalone Docker configuration: "
98+
cat "${CONFIG_FILE}"
99+
97100
EXTRA_LIBS=""
98101

99102
if [ "${SE_ENABLE_TRACING}" = "true" ] && [ -n "${SE_OTEL_EXPORTER_ENDPOINT}" ]; then
@@ -149,7 +152,7 @@ java ${JAVA_OPTS:-$SE_JAVA_OPTS} \
149152
--relax-checks ${SE_RELAX_CHECKS} \
150153
--detect-drivers false \
151154
--bind-host ${SE_BIND_HOST} \
152-
--config /opt/selenium/config.toml \
155+
--config ${CONFIG_FILE} \
153156
${SE_GRID_URL} ${SE_OPTS} &
154157

155158
SELENIUM_SERVER_PID=$!

0 commit comments

Comments
 (0)