Skip to content

Commit ca4da7a

Browse files
committed
Setting env var for docker build, plus leaving selenium files under home user folder.
1 parent fe860cb commit ca4da7a

File tree

1 file changed

+23
-9
lines changed

1 file changed

+23
-9
lines changed

Base/Dockerfile

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,15 @@ RUN echo "deb http://archive.ubuntu.com/ubuntu xenial main universe\n" > /etc/a
88
&& echo "deb http://archive.ubuntu.com/ubuntu xenial-updates main universe\n" >> /etc/apt/sources.list \
99
&& echo "deb http://security.ubuntu.com/ubuntu xenial-security main universe\n" >> /etc/apt/sources.list
1010

11+
# No interactive frontend during docker build
12+
ENV DEBIAN_FRONTEND=noninteractive \
13+
DEBCONF_NONINTERACTIVE_SEEN=true
14+
1115
#========================
1216
# Miscellaneous packages
1317
# Includes minimal runtime used for executing non GUI Java programs
1418
#========================
15-
RUN apt-get update -qqy \
19+
RUN apt-get -qqy update \
1620
&& apt-get -qqy --no-install-recommends install \
1721
bzip2 \
1822
ca-certificates \
@@ -32,16 +36,26 @@ ENV TZ "UTC"
3236
RUN echo "${TZ}" > /etc/timezone \
3337
&& dpkg-reconfigure --frontend noninteractive tzdata
3438

35-
#==========
36-
# Selenium
37-
#==========
38-
RUN mkdir -p /opt/selenium \
39-
&& wget --no-verbose https://selenium-release.storage.googleapis.com/3.4/selenium-server-standalone-3.4.0.jar -O /opt/selenium/selenium-server-standalone.jar
40-
4139
#========================================
4240
# Add normal user with passwordless sudo
4341
#========================================
44-
RUN sudo useradd seluser --shell /bin/bash --create-home \
45-
&& sudo usermod -a -G sudo seluser \
42+
RUN useradd seluser \
43+
--shell /bin/bash \
44+
--create-home \
45+
&& usermod -a -G sudo seluser \
4646
&& echo 'ALL ALL = (ALL) NOPASSWD: ALL' >> /etc/sudoers \
4747
&& echo 'seluser:secret' | chpasswd
48+
49+
#===================================================
50+
# Run the following commands as non-privileged user
51+
#===================================================
52+
USER seluser
53+
WORKDIR /home/seluser
54+
55+
#==========
56+
# Selenium
57+
#==========
58+
RUN mkdir -p /home/seluser/selenium \
59+
&& wget --no-verbose https://selenium-release.storage.googleapis.com/3.4/selenium-server-standalone-3.4.0.jar \
60+
-O /home/seluser/selenium/selenium-server-standalone.jar
61+

0 commit comments

Comments
 (0)