@@ -4,7 +4,7 @@ LABEL authors="Selenium <selenium-developers@googlegroups.com>"
4
4
# Arguments to define the version of dependencies to download
5
5
ARG VERSION
6
6
ARG RELEASE=selenium-${VERSION}
7
- ARG GH_ORG =SeleniumHQ
7
+ ARG AUTHORS =SeleniumHQ
8
8
# Default value should be aligned with upstream Selenium (https://github.com/SeleniumHQ/selenium/blob/trunk/java/maven_deps.bzl)
9
9
ARG OPENTELEMETRY_VERSION=1.36.0
10
10
ARG GRPC_VERSION=1.62.2
@@ -15,27 +15,31 @@ ARG SEL_GROUP=${SEL_USER}
15
15
ARG SEL_PASSWD=secret
16
16
ARG UID=1200
17
17
ARG GID=1201
18
-
19
- USER root
20
- # ================================================
21
- # Customize sources for apt-get
22
- # ================================================
23
- RUN echo "deb http://archive.ubuntu.com/ubuntu jammy main universe\n " > /etc/apt/sources.list \
24
- && echo "deb http://archive.ubuntu.com/ubuntu jammy-updates main universe\n " >> /etc/apt/sources.list \
25
- && echo "deb http://security.ubuntu.com/ubuntu jammy-security main universe\n " >> /etc/apt/sources.list
18
+ ARG TZ="UTC"
19
+ ARG JRE_VERSION=17
26
20
ARG TARGETARCH=amd64
27
21
ARG TARGETVARIANT
28
22
29
- # No interactive frontend during docker build
23
+ USER root
24
+
30
25
ENV DEBIAN_FRONTEND=noninteractive \
31
- DEBCONF_NONINTERACTIVE_SEEN=true
26
+ # No interactive frontend during docker build
27
+ DEBCONF_NONINTERACTIVE_SEEN=true \
28
+ SEL_USER=${SEL_USER} \
29
+ SEL_UID=${UID} \
30
+ SEL_GID=${GID} \
31
+ HOME=/home/${SEL_USER} \
32
+ TZ=${TZ} \
33
+ SEL_DOWNLOAD_DIR=${HOME}/Downloads
32
34
33
35
# ========================
34
36
# Miscellaneous packages
35
37
# Includes minimal runtime used for executing non GUI Java programs
36
38
# ========================
37
- ARG JRE_VERSION=17
38
- RUN apt-get -qqy update \
39
+ RUN echo "deb http://archive.ubuntu.com/ubuntu jammy main universe\n " > /etc/apt/sources.list \
40
+ && echo "deb http://archive.ubuntu.com/ubuntu jammy-updates main universe\n " >> /etc/apt/sources.list \
41
+ && echo "deb http://security.ubuntu.com/ubuntu jammy-security main universe\n " >> /etc/apt/sources.list \
42
+ && apt-get -qqy update \
39
43
&& apt-get upgrade -yq \
40
44
&& apt-get -qqy --no-install-recommends install \
41
45
acl \
@@ -56,40 +60,24 @@ RUN apt-get -qqy update \
56
60
&& echo "deb [signed-by=/etc/apt/keyrings/adoptium.asc] https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" | tee /etc/apt/sources.list.d/adoptium.list >dev/null \
57
61
&& apt-get -qqy update \
58
62
&& apt-get -qqy --no-install-recommends install temurin-${JRE_VERSION}-jre -y \
59
- && rm -rf /var/lib/apt/lists/* /var/cache/apt/*
60
-
61
- # ===================
62
-
63
- RUN if [ $TARGETARCH = "arm" ] && [ $TARGETVARIANT = "v7" ]; then \
63
+ && if [ "${TARGETARCH}" = "arm" ] && [ "${TARGETVARIANT}" = "v7" ]; then \
64
64
export ARCH=armhf ; \
65
65
else \
66
- export ARCH=$TARGETARCH ; \
66
+ export ARCH=${ TARGETARCH} ; \
67
67
fi \
68
- && sed -i 's/securerandom\. source=file:\/ dev\/ random/securerandom\. source=file:\/ dev\/ urandom/' ./usr/lib/jvm/temurin-${JRE_VERSION}-jre-$ARCH/conf/security/java.security
69
-
70
-
68
+ && sed -i 's/securerandom\. source=file:\/ dev\/ random/securerandom\. source=file:\/ dev\/ urandom/' ./usr/lib/jvm/temurin-${JRE_VERSION}-jre-${ARCH}/conf/security/java.security \
69
+ && rm -rf /var/lib/apt/lists/* /var/cache/apt/* \
71
70
# ===================
72
71
# Timezone settings
73
72
# Possible alternative: https://github.com/docker/docker/issues/3359#issuecomment-32150214
74
73
# ===================
75
- ENV TZ "UTC"
76
- RUN ln -fs /usr/share/zoneinfo/${TZ} /etc/localtime && \
74
+ && ln -fs /usr/share/zoneinfo/${TZ} /etc/localtime && \
77
75
dpkg-reconfigure -f noninteractive tzdata && \
78
- cat /etc/timezone
79
-
80
- # ======================================
81
- # Configure environement
82
- # ======================================
83
- ENV SEL_USER=${SEL_USER}
84
- ENV SEL_UID=${UID}
85
- ENV SEL_GID=${GID}
86
- ENV HOME=/home/${SEL_USER}
87
- ENV SEL_DOWNLOAD_DIR=${HOME}/Downloads
88
-
76
+ cat /etc/timezone \
89
77
# ========================================
90
- # Add normal user and group with passwordless sudo
78
+ # Add normal user and group without password sudo
91
79
# ========================================
92
- RUN groupadd ${SEL_GROUP} \
80
+ && groupadd ${SEL_GROUP} \
93
81
--gid ${SEL_GID} \
94
82
&& useradd ${SEL_USER} \
95
83
--create-home \
@@ -98,75 +86,63 @@ RUN groupadd ${SEL_GROUP} \
98
86
--uid ${SEL_UID} \
99
87
&& usermod -a -G sudo ${SEL_USER} \
100
88
&& echo 'ALL ALL = (ALL) NOPASSWD: ALL' >> /etc/sudoers \
101
- && echo "${SEL_USER}:${SEL_PASSWD}" | chpasswd
102
-
103
- # ======================================
104
- # Add Grid check script
105
- # ======================================
106
- COPY --chown="${SEL_UID}:${SEL_GID}" check-grid.sh entry_point.sh /opt/bin/
107
-
108
- # ======================================
109
- # Add Supervisor configuration file
110
- # ======================================
111
- COPY supervisord.conf /etc
112
-
89
+ && echo "${SEL_USER}:${SEL_PASSWD}" | chpasswd \
113
90
# ==========
114
91
# Selenium & relaxing permissions for OpenShift and other non-sudo environments
115
92
# ==========
116
- RUN mkdir -p /opt/selenium /opt/selenium/assets /var/run/supervisor /var/log/supervisor ${SEL_DOWNLOAD_DIR} \
93
+ && mkdir -p /opt/selenium /opt/selenium/assets /var/run/supervisor /var/log/supervisor ${SEL_DOWNLOAD_DIR} \
117
94
${HOME}/.mozilla ${HOME}/.vnc $HOME/.pki/nssdb \
95
+ # NSSDB initialization with an empty password
96
+ && certutil -d sql:$HOME/.pki/nssdb -N --empty-password \
118
97
&& touch /opt/selenium/config.toml \
119
98
&& chown -R ${SEL_USER}:${SEL_GROUP} /opt/selenium /var/run/supervisor /var/log/supervisor /etc/passwd ${HOME} \
120
99
&& chmod -R 775 /opt/selenium /var/run/supervisor /var/log/supervisor /etc/passwd ${HOME} \
121
- && wget --no-verbose https://github.com/${GH_ORG }/selenium/releases/download/${RELEASE}/selenium-server-${VERSION}.jar \
100
+ && wget --no-verbose https://github.com/${AUTHORS }/selenium/releases/download/${RELEASE}/selenium-server-${VERSION}.jar \
122
101
-O /opt/selenium/selenium-server.jar \
123
102
&& echo "${SEL_PASSWD}" > /opt/selenium/initialPasswd \
124
103
&& chgrp -R 0 /opt/selenium ${HOME} /opt/selenium/assets /var/run/supervisor /var/log/supervisor \
125
104
&& chmod -R g=u /opt/selenium ${HOME} /opt/selenium/assets /var/run/supervisor /var/log/supervisor \
126
105
&& setfacl -Rm u:${SEL_USER}:rwx /opt /opt/selenium ${HOME} /opt/selenium/assets /var/run/supervisor /var/log/supervisor \
127
- && setfacl -Rm g:${SEL_GROUP}:rwx /opt /opt/selenium ${HOME} /opt/selenium/assets /var/run/supervisor /var/log/supervisor
128
-
106
+ && setfacl -Rm g:${SEL_GROUP}:rwx /opt /opt/selenium ${HOME} /opt/selenium/assets /var/run/supervisor /var/log/supervisor \
129
107
# =====
130
- # Download observability related jaegar jars and make them available in a separate directory
108
+ # Download observability related OpenTelemetry jars and make them available in a separate directory
131
109
# so that the container can skip downloading them everytime it comes up
132
110
# =====
133
- RUN curl -fLo /tmp/cs https://github.com/coursier/launchers/raw/master/coursier \
111
+ && curl -fLo /tmp/cs https://github.com/coursier/launchers/raw/master/coursier \
134
112
&& chmod +x /tmp/cs \
135
113
&& mkdir -p /external_jars \
136
- && chmod -R 775 /external_jars
137
-
138
- RUN /tmp/cs fetch --classpath --cache /external_jars \
114
+ && chmod -R 775 /external_jars \
115
+ && /tmp/cs fetch --classpath --cache /external_jars \
139
116
io.opentelemetry:opentelemetry-exporter-otlp:${OPENTELEMETRY_VERSION} \
140
- io.grpc:grpc-netty:${GRPC_VERSION} > /external_jars/.classpath.txt
117
+ io.grpc:grpc-netty:${GRPC_VERSION} > /external_jars/.classpath.txt \
118
+ && chmod 664 /external_jars/.classpath.txt \
119
+ && rm -fr /root/.cache/* \
120
+ # (Note that .bashrc is only executed in interactive bash shells.)
121
+ && echo 'if [[ $(ulimit -n) -gt 200000 ]]; then echo "WARNING: Very high value reported by \" ulimit -n\" . Consider passing \" --ulimit nofile=32768\" to \" docker run\" ."; fi' >> ${HOME}/.bashrc
141
122
142
- RUN chmod 664 /external_jars/.classpath.txt
143
- RUN rm -fr /root/.cache/*
123
+ # ======================================
124
+ # Add Grid check script
125
+ # ======================================
126
+ COPY --chown="${SEL_UID}:${SEL_GID}" check-grid.sh entry_point.sh /opt/bin/
127
+
128
+ # ======================================
129
+ # Add Supervisor configuration file
130
+ # ======================================
131
+ COPY supervisord.conf /etc
144
132
145
133
# ===================================================
146
134
# Run the following commands as non-privileged user
147
135
# ===================================================
148
136
USER ${SEL_UID}:${SEL_GID}
149
137
150
- # ==========
151
- # NSSDB initialization with an empty password
152
- # ==========
153
- RUN certutil -d sql:$HOME/.pki/nssdb -N --empty-password
154
-
155
- # Boolean value, maps "--bind-host"
156
- ENV SE_BIND_HOST false
157
- # Boolean value, maps "--reject-unsupported-caps"
158
- ENV SE_REJECT_UNSUPPORTED_CAPS false
159
-
160
- ENV SE_OTEL_JAVA_GLOBAL_AUTOCONFIGURE_ENABLED true
161
- ENV SE_OTEL_TRACES_EXPORTER "otlp"
162
-
163
- # A too high maximum number of file descriptors (with the default value
164
- # inherited from the docker host) can cause issues with some of our tools:
165
- # - sanitizers hanging: https://github.com/google/sanitizers/issues/1662
166
- # - valgrind crashing: https://stackoverflow.com/a/75293014
167
- # This is not be a problem on our CI hosts, but developers who run the image
168
- # on their machines may run into this (e.g., on Arch Linux), so warn them.
169
- # (Note that .bashrc is only executed in interactive bash shells.)
170
- RUN echo 'if [[ $(ulimit -n) -gt 200000 ]]; then echo "WARNING: Very high value reported by \" ulimit -n\" . Consider passing \" --ulimit nofile=32768\" to \" docker run\" ."; fi' >> ${HOME}/.bashrc
138
+ # ======================================
139
+ # Configure environement
140
+ # ======================================
141
+ # Boolean value, maps "--bind-host"
142
+ ENV SE_BIND_HOST=false \
143
+ # Boolean value, maps "--reject-unsupported-caps"
144
+ SE_REJECT_UNSUPPORTED_CAPS=false \
145
+ SE_OTEL_JAVA_GLOBAL_AUTOCONFIGURE_ENABLED=true \
146
+ SE_OTEL_TRACES_EXPORTER="otlp"
171
147
172
148
CMD ["/opt/bin/entry_point.sh" ]
0 commit comments