Skip to content

Commit e39dcc7

Browse files
committed
Refactoring common config for Chrome and Firefox nodes, running commands as seluser
1 parent 4369255 commit e39dcc7

File tree

3 files changed

+29
-49
lines changed

3 files changed

+29
-49
lines changed

NodeBase/Dockerfile.txt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,27 @@ 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+
53+
# Following line fixes https://github.com/SeleniumHQ/docker-selenium/issues/87
54+
ENV DBUS_SESSION_BUS_ADDRESS=/dev/null
55+
3356
CMD ["/opt/bin/entry_point.sh"]

NodeChrome/Dockerfile.txt

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -33,32 +33,9 @@ RUN wget --no-verbose -O /tmp/chromedriver_linux64.zip https://chromedriver.stor
3333
&& chmod 755 /home/seluser/selenium/chromedriver-$CHROME_DRIVER_VERSION \
3434
&& sudo ln -fs /home/seluser/selenium/chromedriver-$CHROME_DRIVER_VERSION /usr/bin/chromedriver
3535

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

5838
#=================================
5939
# Chrome Launch Script Modification
6040
#=================================
6141
COPY chrome_launcher.sh /opt/google/chrome/google-chrome
62-
63-
# Following line fixes https://github.com/SeleniumHQ/docker-selenium/issues/87
64-
ENV DBUS_SESSION_BUS_ADDRESS=/dev/null

NodeFirefox/Dockerfile.txt

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -27,31 +27,11 @@ RUN wget --no-verbose -O /tmp/geckodriver.tar.gz https://github.com/mozilla/geck
2727
&& chmod 755 /opt/geckodriver-$GECKODRIVER_VERSION \
2828
&& ln -fs /opt/geckodriver-$GECKODRIVER_VERSION /usr/bin/geckodriver
2929

30-
#========================
31-
# Selenium Configuration
32-
#========================
33-
# As integer, maps to "maxInstances"
34-
ENV NODE_MAX_INSTANCES 1
35-
# As integer, maps to "maxSession"
36-
ENV NODE_MAX_SESSION 1
37-
# As integer, maps to "port"
38-
ENV NODE_PORT 5555
39-
# In milliseconds, maps to "registerCycle"
40-
ENV NODE_REGISTER_CYCLE 5000
41-
# In milliseconds, maps to "nodePolling"
42-
ENV NODE_POLLING 5000
43-
# In milliseconds, maps to "unregisterIfStillDownAfter"
44-
ENV NODE_UNREGISTER_IF_STILL_DOWN_AFTER 60000
45-
# As integer, maps to "downPollingLimit"
46-
ENV NODE_DOWN_POLLING_LIMIT 2
47-
# As string, maps to "applicationName"
48-
ENV NODE_APPLICATION_NAME ""
49-
50-
COPY generate_config /opt/selenium/generate_config
51-
RUN chmod +x /opt/selenium/generate_config \
52-
&& chown -R seluser:seluser /opt/selenium
30+
USER seluser
5331

54-
# Following line fixes https://github.com/SeleniumHQ/docker-selenium/issues/87
55-
ENV DBUS_SESSION_BUS_ADDRESS=/dev/null
32+
COPY generate_config /opt/bin/generate_config
5633

57-
USER seluser
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 ""

0 commit comments

Comments
 (0)