Skip to content

Commit 5ba82cc

Browse files
committed
update python agent dockerfile to be aboe to run without nexus configured
1 parent e764ffa commit 5ba82cc

1 file changed

Lines changed: 17 additions & 15 deletions

File tree

common/jenkins-agents/python/docker/Dockerfile.ubi9

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,33 @@ ARG nexusAuth
77

88
ENV PYTHONUNBUFFERED=1 \
99
PYTHONIOENCODING=UTF-8 \
10-
UV_INDEX_URL=https://${nexusAuth}@${nexusHost}/repository/pypi-all/simple \
11-
PIP_TRUSTED_HOST=${nexusHost} \
1210
UV_CA_CERTIFICATE=/etc/ssl/certs/ca-bundle.crt \
11+
PIP_CERT=/etc/ssl/certs/ca-bundle.crt \
1312
PATH=$HOME/.local/bin:$JAVA_HOME/bin:$PATH \
1413
UV_VERSION=0.10.9
1514

16-
ENV UV_DEFAULT_INDEX=${UV_INDEX_URL} \
17-
PIP_INDEX_URL=${UV_INDEX_URL} \
18-
PIP_CERT=${UV_CA_CERTIFICATE}
19-
15+
# Set PyPI URLs and configure Python packages
2016
RUN yum install -y autoconf automake gcc gcc-c++ openssl-devel libffi-devel && \
2117
curl -LsSf https://astral.sh/uv/${UV_VERSION}/install.sh | sh && \
2218
mkdir -p $HOME/.config/pip && \
2319
echo "[global]" > $HOME/.config/pip/pip.conf && \
24-
echo "index-url = https://${nexusAuth}@${nexusHost}/repository/pypi-all/simple" >> $HOME/.config/pip/pip.conf && \
25-
echo "trusted-host = ${nexusHost}" >> $HOME/.config/pip/pip.conf && \
20+
if [ -n "${nexusHost}" ] && [ -n "${nexusAuth}" ]; then \
21+
echo "index-url = https://${nexusAuth}@${nexusHost}/repository/pypi-all/simple" >> $HOME/.config/pip/pip.conf && \
22+
echo "trusted-host = ${nexusHost}" >> $HOME/.config/pip/pip.conf && \
23+
echo "export UV_DEFAULT_INDEX=https://${nexusAuth}@${nexusHost}/repository/pypi-all/simple" > /etc/profile.d/uv-index.sh; \
24+
else \
25+
echo "export UV_DEFAULT_INDEX=https://pypi.org/simple" > /etc/profile.d/uv-index.sh; \
26+
fi && \
2627
yum -y clean all
2728

28-
RUN for pyVersion in 3.8 3.9 3.11 3.12; do \
29-
uv python install $pyVersion && \
30-
uv pip install --verbose --system --break-system-packages --python $pyVersion --trusted-host ${nexusHost} \
31-
virtualenv==20.26.3 \
32-
setuptools==72.2.0 \
33-
Cython==3.0.11 \
34-
pypandoc==1.13; \
29+
RUN PACKAGES="virtualenv==20.26.3 setuptools==72.2.0 Cython==3.0.11 pypandoc==1.13" && \
30+
for pyVersion in 3.8 3.9 3.11 3.12; do \
31+
uv python install $pyVersion && \
32+
if [ -n "${nexusHost}" ] && [ -n "${nexusAuth}" ]; then \
33+
uv pip install --verbose --system --break-system-packages --python $pyVersion --trusted-host ${nexusHost} $PACKAGES; \
34+
else \
35+
uv pip install --verbose --system --break-system-packages --python $pyVersion $PACKAGES; \
36+
fi; \
3537
done && \
3638
uv tool update-shell
3739

0 commit comments

Comments
 (0)