This repository has been archived by the owner on Jun 22, 2024. It is now read-only.
forked from SeleniumHQ/docker-selenium
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
92 changed files
with
1,900 additions
and
478 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: Scan Dockerfile vulnerabilities | ||
|
||
on: | ||
push: | ||
paths: | ||
- '**/Dockerfile' | ||
pull_request: | ||
paths: | ||
- '**/Dockerfile' | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '0 0 * * *' | ||
|
||
jobs: | ||
build-and-scan: | ||
name: Scan Dockerfile vulnerabilities | ||
permissions: write-all | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set severity for PRs | ||
if: github.event_name == 'pull_request' || github.event_name == 'push' | ||
run: | | ||
echo "SEVERITY=HIGH,CRITICAL" >> $GITHUB_ENV | ||
echo "EXIT_CODE=1" >> $GITHUB_ENV | ||
- name: Set severity for others | ||
if: github.event_name != 'pull_request' && github.event_name != 'push' | ||
run: | | ||
echo "SEVERITY=LOW,MEDIUM,HIGH,CRITICAL" >> $GITHUB_ENV | ||
echo "EXIT_CODE=0" >> $GITHUB_ENV | ||
- name: Scan source code | ||
uses: aquasecurity/trivy-action@master | ||
with: | ||
scan-type: 'fs' | ||
scan-ref: '.' | ||
format: 'sarif' | ||
output: 'source-results.sarif' | ||
scanners: 'vuln,secret,misconfig' | ||
skip-dirs: 'tests,Video' | ||
exit-code: '${{ env.EXIT_CODE }}' | ||
severity: '${{ env.SEVERITY }}' | ||
limit-severities-for-sarif: true | ||
- name: Upload source scan results to annotations | ||
if: always() | ||
uses: Ayrx/sarif_to_github_annotations@master | ||
with: | ||
sarif_file: 'source-results.sarif' | ||
- name: Upload source scan results to GitHub Security tab | ||
if: github.event_name != 'pull_request' | ||
uses: github/codeql-action/upload-sarif@v3 | ||
with: | ||
sarif_file: 'source-results.sarif' | ||
category: source-results |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Update Chart CHANGELOG | ||
|
||
on: | ||
release: | ||
types: [published] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
permissions: write-all | ||
if: ${{ contains(github.event.release.tag_name, 'selenium-grid') || github.event_name == 'workflow_dispatch' }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
persist-credentials: false | ||
fetch-depth: 0 | ||
|
||
- name: Update chart CHANGELOG | ||
run: ./generate_chart_changelog.sh | ||
|
||
- name: Commit files | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "Selenium CI Bot" | ||
git commit -m "Update chart CHANGELOG [skip ci]" -a | ||
- name: Push changes | ||
uses: ad-m/github-push-action@master | ||
with: | ||
github_token: ${{ secrets.SELENIUM_CI_TOKEN }} | ||
branch: trunk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,11 +5,26 @@ | |
#FROM ubuntu:focal-20220415 | ||
#FROM ubuntu:focal-20220531 | ||
#FROM ubuntu:focal-20230301 | ||
#FROM ubuntu:jammy-20231128 | ||
FROM debian:bookworm | ||
|
||
LABEL authors="Selenium <[email protected]>" | ||
|
||
# Arguments to define the version of dependencies to download | ||
ARG VERSION | ||
ARG RELEASE=selenium-${VERSION} | ||
# Default value should be aligned with upstream Selenium (https://github.com/SeleniumHQ/selenium/blob/trunk/java/maven_deps.bzl) | ||
ARG OPENTELEMETRY_VERSION=1.28.0 | ||
ARG GRPC_VERSION=1.57.1 | ||
|
||
#Arguments to define the user running Selenium | ||
ARG SEL_USER=seluser | ||
ARG SEL_GROUP=${SEL_USER} | ||
ARG SEL_PASSWD=secret | ||
ARG UID=1200 | ||
ARG GID=1201 | ||
|
||
USER root | ||
#================================================ | ||
# Customize sources for apt-get | ||
#================================================ | ||
|
@@ -42,6 +57,7 @@ RUN apt-get -qqy update \ | |
curl \ | ||
supervisor \ | ||
gnupg2 \ | ||
libnss3-tools \ | ||
&& mkdir -p /etc/apt/keyrings \ | ||
&& wget -O - https://packages.adoptium.net/artifactory/api/gpg/key/public | tee /etc/apt/keyrings/adoptium.asc \ | ||
&& 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 \ | ||
|
@@ -58,7 +74,6 @@ RUN if [ $TARGETARCH = "arm" ] && [ $TARGETVARIANT = "v7" ]; then \ | |
fi \ | ||
&& sed -i 's/securerandom\.source=file:\/dev\/random/securerandom\.source=file:\/dev\/urandom/' ./usr/lib/jvm/temurin-11-jre-$ARCH/conf/security/java.security | ||
|
||
|
||
#=================== | ||
# Timezone settings | ||
# Possible alternative: https://github.com/docker/docker/issues/3359#issuecomment-32150214 | ||
|
@@ -68,25 +83,33 @@ RUN ln -fs /usr/share/zoneinfo/${TZ} /etc/localtime && \ | |
dpkg-reconfigure -f noninteractive tzdata && \ | ||
cat /etc/timezone | ||
|
||
#====================================== | ||
# Configure environement | ||
#====================================== | ||
ENV SEL_USER=${SEL_USER} | ||
ENV SEL_UID=${UID} | ||
ENV SEL_GID=${GID} | ||
ENV HOME=/home/${SEL_USER} | ||
ENV SEL_DOWNLOAD_DIR=${HOME}/Downloads | ||
|
||
#======================================== | ||
# Add normal user and group with passwordless sudo | ||
#======================================== | ||
RUN groupadd seluser \ | ||
--gid 1201 \ | ||
&& useradd seluser \ | ||
RUN groupadd ${SEL_GROUP} \ | ||
--gid ${SEL_GID} \ | ||
&& useradd ${SEL_USER} \ | ||
--create-home \ | ||
--gid 1201 \ | ||
--gid ${SEL_GID} \ | ||
--shell /bin/bash \ | ||
--uid 1200 \ | ||
&& usermod -a -G sudo seluser \ | ||
--uid ${SEL_UID} \ | ||
&& usermod -a -G sudo ${SEL_USER} \ | ||
&& echo 'ALL ALL = (ALL) NOPASSWD: ALL' >> /etc/sudoers \ | ||
&& echo 'seluser:secret' | chpasswd | ||
ENV HOME=/home/seluser | ||
&& echo "${SEL_USER}:${SEL_PASSWD}" | chpasswd | ||
|
||
#====================================== | ||
# Add Grid check script | ||
#====================================== | ||
COPY check-grid.sh entry_point.sh /opt/bin/ | ||
COPY --chown="${SEL_UID}:${SEL_GID}" check-grid.sh entry_point.sh /opt/bin/ | ||
|
||
#====================================== | ||
# Add Supervisor configuration file | ||
|
@@ -96,14 +119,17 @@ COPY supervisord.conf /etc | |
#========== | ||
# Selenium & relaxing permissions for OpenShift and other non-sudo environments | ||
#========== | ||
RUN mkdir -p /opt/selenium /opt/selenium/assets /var/run/supervisor /var/log/supervisor \ | ||
RUN mkdir -p /opt/selenium /opt/selenium/assets /var/run/supervisor /var/log/supervisor ${SEL_DOWNLOAD_DIR} ${HOME}/.mozilla ${HOME}/.vnc \ | ||
&& touch /opt/selenium/config.toml \ | ||
&& chmod -R 777 /opt/selenium /opt/selenium/assets /var/run/supervisor /var/log/supervisor /etc/passwd \ | ||
&& chown -R ${SEL_USER}:${SEL_GROUP} /opt/selenium /var/run/supervisor /var/log/supervisor /etc/passwd ${HOME} \ | ||
&& chmod -R 775 /opt/selenium /var/run/supervisor /var/log/supervisor /etc/passwd ${HOME} \ | ||
&& wget --no-verbose https://github.com/SeleniumHQ/selenium/releases/download/${RELEASE}/selenium-server-${VERSION}.jar \ | ||
-O /opt/selenium/selenium-server.jar \ | ||
&& echo "${SEL_PASSWD}" > /opt/selenium/initialPasswd \ | ||
&& chgrp -R 0 /opt/selenium ${HOME} /opt/selenium/assets /var/run/supervisor /var/log/supervisor \ | ||
&& chmod -R g=u /opt/selenium ${HOME} /opt/selenium/assets /var/run/supervisor /var/log/supervisor \ | ||
&& setfacl -Rm u:seluser:rwx /opt /opt/selenium ${HOME} /opt/selenium/assets /var/run/supervisor /var/log/supervisor | ||
&& setfacl -Rm u:${SEL_USER}:rwx /opt /opt/selenium ${HOME} /opt/selenium/assets /var/run/supervisor /var/log/supervisor \ | ||
&& setfacl -Rm g:${SEL_GROUP}:rwx /opt /opt/selenium ${HOME} /opt/selenium/assets /var/run/supervisor /var/log/supervisor | ||
|
||
#===== | ||
# Download observability related jaegar jars and make them available in a separate directory | ||
|
@@ -120,9 +146,9 @@ RUN if [ `arch` = "aarch64" ]; then \ | |
|
||
RUN if [ -f "/tmp/cs" ]; then \ | ||
/tmp/cs fetch --classpath --cache /external_jars \ | ||
io.opentelemetry:opentelemetry-exporter-otlp:1.31.0 \ | ||
io.opentelemetry:opentelemetry-exporter-jaeger:1.31.0 \ | ||
io.grpc:grpc-netty:1.59.0 > /external_jars/.classpath.txt ; \ | ||
io.opentelemetry:opentelemetry-exporter-otlp:${OPENTELEMETRY_VERSION} \ | ||
io.opentelemetry:opentelemetry-exporter-jaeger:${OPENTELEMETRY_VERSION} \ | ||
io.grpc:grpc-netty:${GRPC_VERSION} > /external_jars/.classpath.txt ; \ | ||
fi | ||
|
||
RUN if [ -f "/tmp/cs" ]; then chmod 664 /external_jars/.classpath.txt ; fi | ||
|
@@ -131,9 +157,19 @@ RUN rm -fr /root/.cache/* | |
#=================================================== | ||
# Run the following commands as non-privileged user | ||
#=================================================== | ||
USER 1200:1201 | ||
USER ${SEL_UID}:${SEL_GID} | ||
VOLUME ${SEL_DOWNLOAD_DIR} | ||
|
||
# Boolean value, maps "--bind-host" | ||
ENV SE_BIND_HOST false | ||
|
||
# A too high maximum number of file descriptors (with the default value | ||
# inherited from the docker host) can cause issues with some of our tools: | ||
# - sanitizers hanging: https://github.com/google/sanitizers/issues/1662 | ||
# - valgrind crashing: https://stackoverflow.com/a/75293014 | ||
# This is not be a problem on our CI hosts, but developers who run the image | ||
# on their machines may run into this (e.g., on Arch Linux), so warn them. | ||
# (Note that .bashrc is only executed in interactive bash shells.) | ||
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 | ||
|
||
CMD ["/opt/bin/entry_point.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.