Skip to content

Commit 033214c

Browse files
committed
Fix for issue with not being able to pass environment variables into node containers at runtime
When changes were introduced to generate default config during build time with SeleniumHQ#502 and then with SeleniumHQ#529, it broke the ability to pass in environment variables to the node containers at runtime. This fix aims to provide the ability to do both i.e. continue to pass environment variables at runtime and generate a default config at build time for the node.
1 parent b2f3abc commit 033214c

File tree

3 files changed

+40
-25
lines changed

3 files changed

+40
-25
lines changed

NodeBase/Dockerfile.txt

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,26 +30,6 @@ ENV SCREEN_HEIGHT 1020
3030
ENV SCREEN_DEPTH 24
3131
ENV DISPLAY :99.0
3232

33-
#========================
34-
# Selenium Configuration
35-
#========================
36-
# As integer, maps to "maxInstances"
37-
ENV NODE_MAX_INSTANCES 1
38-
# As integer, maps to "maxSession"
39-
ENV NODE_MAX_SESSION 1
40-
# As integer, maps to "port"
41-
ENV NODE_PORT 5555
42-
# In milliseconds, maps to "registerCycle"
43-
ENV NODE_REGISTER_CYCLE 5000
44-
# In milliseconds, maps to "nodePolling"
45-
ENV NODE_POLLING 5000
46-
# In milliseconds, maps to "unregisterIfStillDownAfter"
47-
ENV NODE_UNREGISTER_IF_STILL_DOWN_AFTER 60000
48-
# As integer, maps to "downPollingLimit"
49-
ENV NODE_DOWN_POLLING_LIMIT 2
50-
# As string, maps to "applicationName"
51-
ENV NODE_APPLICATION_NAME ""
52-
5333
# Following line fixes https://github.com/SeleniumHQ/docker-selenium/issues/87
5434
ENV DBUS_SESSION_BUS_ADDRESS=/dev/null
5535

NodeChrome/Dockerfile.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,26 @@ RUN CD_VERSION=$(if [ ${CHROME_DRIVER_VERSION:-latest} = "latest" ]; then echo $
3838
&& chmod 755 /opt/selenium/chromedriver-$CD_VERSION\
3939
&& sudo ln -fs /opt/selenium/chromedriver-$CD_VERSION/usr/bin/chromedriver
4040

41+
#========================
42+
# Selenium Configuration
43+
#========================
44+
# As integer, maps to "maxInstances"
45+
ENV NODE_MAX_INSTANCES 1
46+
# As integer, maps to "maxSession"
47+
ENV NODE_MAX_SESSION 1
48+
# As integer, maps to "port"
49+
ENV NODE_PORT 5555
50+
# In milliseconds, maps to "registerCycle"
51+
ENV NODE_REGISTER_CYCLE 5000
52+
# In milliseconds, maps to "nodePolling"
53+
ENV NODE_POLLING 5000
54+
# In milliseconds, maps to "unregisterIfStillDownAfter"
55+
ENV NODE_UNREGISTER_IF_STILL_DOWN_AFTER 60000
56+
# As integer, maps to "downPollingLimit"
57+
ENV NODE_DOWN_POLLING_LIMIT 2
58+
# As string, maps to "applicationName"
59+
ENV NODE_APPLICATION_NAME ""
60+
4161
COPY generate_config /opt/bin/generate_config
4262

4363
#=================================

NodeFirefox/Dockerfile.txt

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,27 @@ RUN wget --no-verbose -O /tmp/geckodriver.tar.gz https://github.com/mozilla/geck
2929

3030
USER seluser
3131

32-
COPY generate_config /opt/bin/generate_config
32+
#========================
33+
# Selenium Configuration
34+
#========================
35+
# As integer, maps to "maxInstances"
36+
ENV NODE_MAX_INSTANCES 1
37+
# As integer, maps to "maxSession"
38+
ENV NODE_MAX_SESSION 1
39+
# As integer, maps to "port"
40+
ENV NODE_PORT 5555
41+
# In milliseconds, maps to "registerCycle"
42+
ENV NODE_REGISTER_CYCLE 5000
43+
# In milliseconds, maps to "nodePolling"
44+
ENV NODE_POLLING 5000
45+
# In milliseconds, maps to "unregisterIfStillDownAfter"
46+
ENV NODE_UNREGISTER_IF_STILL_DOWN_AFTER 60000
47+
# As integer, maps to "downPollingLimit"
48+
ENV NODE_DOWN_POLLING_LIMIT 2
49+
# As string, maps to "applicationName"
50+
ENV NODE_APPLICATION_NAME ""
3351

34-
# Running this command as sudo just to avoid the message:
35-
# To run a command as administrator (user "root"), use "sudo <command>". See "man sudo_root" for details.
36-
# When logging into the container
37-
RUN sudo echo ""
52+
COPY generate_config /opt/bin/generate_config
3853

3954
# Generating a default config during build time
4055
RUN /opt/bin/generate_config > /opt/selenium/config.json

0 commit comments

Comments
 (0)