Skip to content

Commit c8064de

Browse files
committed
Running commands as seluser
1 parent 553df4e commit c8064de

File tree

2 files changed

+13
-14
lines changed

2 files changed

+13
-14
lines changed

NodeBase/Dockerfile.txt

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
ENV DEBIAN_FRONTEND noninteractive
2-
ENV DEBCONF_NONINTERACTIVE_SEEN true
1+
USER root
32

43
#==============
54
# VNC and Xvfb
@@ -10,14 +9,18 @@ RUN apt-get update -qqy \
109
xvfb \
1110
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*
1211

12+
#===================================================
13+
# Run the following commands as non-privileged user
14+
#===================================================
15+
16+
USER seluser
17+
1318
#==============================
1419
# Scripts to run Selenium Node
1520
#==============================
16-
COPY \
17-
entry_point.sh \
21+
COPY entry_point.sh \
1822
functions.sh \
1923
/opt/bin/
20-
RUN chmod +x /opt/bin/entry_point.sh
2124

2225
#============================
2326
# Some configuration options
@@ -27,6 +30,4 @@ ENV SCREEN_HEIGHT 1020
2730
ENV SCREEN_DEPTH 24
2831
ENV DISPLAY :99.0
2932

30-
USER seluser
31-
3233
CMD ["/opt/bin/entry_point.sh"]

NodeBase/entry_point.sh

100644100755
Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#!/bin/bash
22

33
source /opt/bin/functions.sh
4-
/opt/selenium/generate_config > /opt/selenium/config.json
4+
/opt/bin/generate_config > /home/seluser/selenium/config.json
55

66
export GEOMETRY="$SCREEN_WIDTH""x""$SCREEN_HEIGHT""x""$SCREEN_DEPTH"
77

8-
if [ ! -e /opt/selenium/config.json ]; then
8+
if [ ! -e /home/seluser/selenium/config.json ]; then
99
echo No Selenium Node configuration file, the node-base image is not intended to be run directly. 1>&2
1010
exit 1
1111
fi
@@ -29,19 +29,17 @@ if [ ! -z "$SE_OPTS" ]; then
2929
echo "appending selenium options: ${SE_OPTS}"
3030
fi
3131

32-
# TODO: Look into http://www.seleniumhq.org/docs/05_selenium_rc.jsp#browser-side-logs
33-
3432
SERVERNUM=$(get_server_num)
3533

3634
rm -f /tmp/.X*lock
3735

3836
xvfb-run -n $SERVERNUM --server-args="-screen 0 $GEOMETRY -ac +extension RANDR" \
39-
java ${JAVA_OPTS} -jar /opt/selenium/selenium-server-standalone.jar \
37+
java ${JAVA_OPTS} -jar /home/seluser/selenium/selenium-server-standalone.jar \
4038
-role node \
4139
-hub http://$HUB_PORT_4444_TCP_ADDR:$HUB_PORT_4444_TCP_PORT/grid/register \
42-
-nodeConfig /opt/selenium/config.json \
40+
-nodeConfig /home/seluser/selenium/config.json \
4341
${SE_OPTS} &
4442
NODE_PID=$!
4543

4644
trap shutdown SIGTERM SIGINT
47-
wait $NODE_PID
45+
wait $NODE_PID

0 commit comments

Comments
 (0)