@@ -11,8 +11,9 @@ ARG OPENTELEMETRY_VERSION=1.55.0
1111ARG GRPC_VERSION=1.76.0
1212ARG NETTY_VERSION=4.2.7.Final
1313ARG CS_VERSION=2.1.25-M18
14- ARG ENVSUBST_VERSION=1.4.6
14+ ARG ENVSUBST_VERSION=1.4.7
1515ARG CURL_VERSION=8.16.0
16+ ARG PYTHON_VERSION=3.13
1617
1718# Arguments to define the user running Selenium
1819ARG SEL_USER=seluser
@@ -67,17 +68,37 @@ RUN apt-get -qqy update \
6768 ca-certificates \
6869 && rm -rf /var/lib/apt/lists/* /var/cache/apt/*
6970
71+ # ========================================
72+ # Add normal user and group without password sudo
73+ # ========================================
74+ RUN --mount=type=secret,id=SEL_PASSWD \
75+ groupadd ${SEL_GROUP} \
76+ --gid ${SEL_GID} \
77+ && useradd ${SEL_USER} \
78+ --create-home \
79+ --gid ${SEL_GID} \
80+ --shell /bin/bash \
81+ --uid ${SEL_UID} \
82+ && usermod -a -G sudo ${SEL_USER} \
83+ && echo 'ALL ALL = (ALL) NOPASSWD: ALL' >> /etc/sudoers \
84+ && echo "${SEL_USER}:$(cat /run/secrets/SEL_PASSWD)" | chpasswd
85+
7086# ========================================
7187# Install Python for utilities
7288# ========================================
7389ENV PATH="$VENV_PATH/bin:$PATH" \
7490 VIRTUAL_ENV="$VENV_PATH"
7591
76- RUN apt-get -qqy update \
92+ RUN gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys F23C5A6CF475977595C89F51BA6932366A755776 \
93+ && gpg --export F23C5A6CF475977595C89F51BA6932366A755776 > /usr/share/keyrings/deadsnakes.pgp \
94+ && echo "deb [signed-by=/usr/share/keyrings/deadsnakes.pgp] https://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu noble main" | tee /etc/apt/sources.list.d/deadsnakes.list \
95+ && apt-get -qqy update \
7796 && apt-get upgrade -yq \
78- && apt-get -qqy --no-install-recommends install \
79- python3 python3-pip python3-venv \
80- && python3 -m pip install --upgrade setuptools virtualenv --break-system-packages \
97+ && apt-get -qqy --no-install-recommends install python${PYTHON_VERSION} python${PYTHON_VERSION}-venv \
98+ && update-alternatives --install /usr/bin/python3 python3 /usr/bin/python${PYTHON_VERSION} 1 \
99+ && update-alternatives --install /usr/bin/python python /usr/bin/python${PYTHON_VERSION} 1 \
100+ && python3 -m ensurepip --upgrade \
101+ && python3 -m pip install --upgrade pip virtualenv --break-system-packages \
81102 && rm -rf /var/lib/apt/lists/* /var/cache/apt/* \
82103 && echo "source $VENV_PATH/bin/activate" >> /etc/bash.bashrc
83104
@@ -86,8 +107,7 @@ RUN ARCH=$(if [ "$(dpkg --print-architecture)" = "arm64" ]; then echo "aarch64";
86107 && chmod +x /usr/bin/curl \
87108 && curl --version
88109
89- RUN --mount=type=secret,id=SEL_PASSWD \
90- if [ "${TARGETARCH}" = "arm" ] && [ "${TARGETVARIANT}" = "v7" ]; then \
110+ RUN if [ "${TARGETARCH}" = "arm" ] && [ "${TARGETVARIANT}" = "v7" ]; then \
91111 export ARCH=armhf ; \
92112 else \
93113 export ARCH=$(dpkg --print-architecture) ; \
@@ -100,19 +120,6 @@ RUN --mount=type=secret,id=SEL_PASSWD \
100120 && ln -fs /usr/share/zoneinfo/${TZ} /etc/localtime && \
101121 dpkg-reconfigure -f noninteractive tzdata && \
102122 cat /etc/timezone \
103- # ========================================
104- # Add normal user and group without password sudo
105- # ========================================
106- && groupadd ${SEL_GROUP} \
107- --gid ${SEL_GID} \
108- && useradd ${SEL_USER} \
109- --create-home \
110- --gid ${SEL_GID} \
111- --shell /bin/bash \
112- --uid ${SEL_UID} \
113- && usermod -a -G sudo ${SEL_USER} \
114- && echo 'ALL ALL = (ALL) NOPASSWD: ALL' >> /etc/sudoers \
115- && echo "${SEL_USER}:$(cat /run/secrets/SEL_PASSWD)" | chpasswd \
116123# ==========
117124# Selenium & relaxing permissions for OpenShift and other non-sudo environments
118125# ==========
@@ -189,7 +196,7 @@ RUN ARCH=$(if [ "$(dpkg --print-architecture)" = "amd64" ]; then echo "x86_64";
189196USER ${SEL_UID}:${SEL_GID}
190197
191198RUN python3 -m venv $VENV_PATH \
192- && $VENV_PATH/bin/python3 -m pip install --upgrade pip setuptools virtualenv psutil requests \
199+ && $VENV_PATH/bin/python3 -m pip install --upgrade pip psutil requests \
193200 && wget -q https://github.com/Supervisor/supervisor/archive/refs/heads/main.zip -O /tmp/supervisor.zip \
194201 && unzip /tmp/supervisor.zip -d /tmp \
195202 && cd /tmp/supervisor-main \
0 commit comments