Skip to content

Commit 4369255

Browse files
committed
Setting file permissions, env vars as seluser executing commands as non root.
1 parent c8064de commit 4369255

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

NodeChrome/Dockerfile.txt

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,19 @@ RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key
1919
&& rm /etc/apt/sources.list.d/google-chrome.list \
2020
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*
2121

22+
USER seluser
23+
2224
#==================
2325
# Chrome webdriver
2426
#==================
2527
ARG CHROME_DRIVER_VERSION=2.29
2628
RUN wget --no-verbose -O /tmp/chromedriver_linux64.zip https://chromedriver.storage.googleapis.com/$CHROME_DRIVER_VERSION/chromedriver_linux64.zip \
27-
&& rm -rf /opt/selenium/chromedriver \
28-
&& unzip /tmp/chromedriver_linux64.zip -d /opt/selenium \
29+
&& rm -rf /home/seluser/selenium/chromedriver \
30+
&& unzip /tmp/chromedriver_linux64.zip -d /home/seluser/selenium \
2931
&& rm /tmp/chromedriver_linux64.zip \
30-
&& mv /opt/selenium/chromedriver /opt/selenium/chromedriver-$CHROME_DRIVER_VERSION \
31-
&& chmod 755 /opt/selenium/chromedriver-$CHROME_DRIVER_VERSION \
32-
&& ln -fs /opt/selenium/chromedriver-$CHROME_DRIVER_VERSION /usr/bin/chromedriver
32+
&& mv /home/seluser/selenium/chromedriver /home/seluser/selenium/chromedriver-$CHROME_DRIVER_VERSION \
33+
&& chmod 755 /home/seluser/selenium/chromedriver-$CHROME_DRIVER_VERSION \
34+
&& sudo ln -fs /home/seluser/selenium/chromedriver-$CHROME_DRIVER_VERSION /usr/bin/chromedriver
3335

3436
#========================
3537
# Selenium Configuration
@@ -51,18 +53,12 @@ ENV NODE_DOWN_POLLING_LIMIT 2
5153
# As string, maps to "applicationName"
5254
ENV NODE_APPLICATION_NAME ""
5355

54-
COPY generate_config /opt/selenium/generate_config
55-
RUN chmod +x /opt/selenium/generate_config
56+
COPY generate_config /opt/bin/generate_config
5657

5758
#=================================
5859
# Chrome Launch Script Modification
5960
#=================================
6061
COPY chrome_launcher.sh /opt/google/chrome/google-chrome
61-
RUN chmod +x /opt/google/chrome/google-chrome
62-
63-
RUN chown -R seluser:seluser /opt/selenium
6462

6563
# Following line fixes https://github.com/SeleniumHQ/docker-selenium/issues/87
6664
ENV DBUS_SESSION_BUS_ADDRESS=/dev/null
67-
68-
USER seluser

NodeChrome/chrome_launcher.sh

100644100755
File mode changed.

0 commit comments

Comments
 (0)