Skip to content

Commit a6b1028

Browse files
committed
[RAPTOR-14742] python311: Drop virtualenv
Since this runs inside of a docker container, there really isn't much point to a virtual env here. It just adds storage overhead and path complexity. That said, additionally, the upstream pip has a security vulnerability, CVE-2025-8869, which has been fixed, but not released, and it is uncertain when the fix will be released. Chainguard has however fixed pip in their version. As such, using system python resources uses their fixed pip version, as using a virtualenv installs its own version of pip, reintroducing the vulnerability.
1 parent eff06a0 commit a6b1028

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

public_dropin_environments/python311/Dockerfile

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ COPY --from=build /bin/mkdir /bin/mkdir
3030

3131
# Required for custom-models to install dependencies
3232
COPY --from=build /usr/bin/pip /usr/bin/pip
33+
COPY --from=build /usr/lib/python3.11/site-packages/pip /usr/lib/python3.11/site-packages/pip
3334

3435
# Cleanup '__pycache__' directories. It solves an AsymmetricPrivateKey scanning error.
3536
COPY --from=build /usr/bin/rm /usr/bin/rm
@@ -40,16 +41,9 @@ COPY --from=build /bin/ls /bin/ls
4041

4142
COPY requirements.txt requirements.txt
4243

43-
ENV VIRTUAL_ENV=/opt/venv
44+
RUN sh -c "python -m pip install --no-cache-dir -r requirements.txt \
45+
&& find /usr -type d -name '__pycache__' -exec rm -rf '{}' +"
4446

45-
RUN sh -c "python -m venv ${VIRTUAL_ENV} && \
46-
. ${VIRTUAL_ENV}/bin/activate && \
47-
python -m ensurepip --default-pip && \
48-
python -m pip install --upgrade pip && \
49-
python -m pip install --no-cache-dir -r requirements.txt && \
50-
find ${VIRTUAL_ENV} -type d -name '__pycache__' -exec rm -rf {} +"
51-
52-
ENV PATH=${VIRTUAL_ENV}/bin:${PATH}
5347
ENV HOME=/opt
5448
ENV CODE_DIR=/opt/code
5549
ENV ADDRESS=0.0.0.0:8080
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
2-
"id": "67a554baeade3a4ce2ab6700",
2+
"id": "67a554bbfbef3a4ce2ab6700",
33
"name": "[DataRobot] Python 3.11 Drop-In",
44
"description": "This template environment can be used to create Python based custom models. User is responsible to provide requirements.txt with the model, to install all the required dependencies.",
55
"programmingLanguage": "python",
66
"label": "",
7-
"environmentVersionId": "68ddb0110008035274003e75",
7+
"environmentVersionId": "67a554bbfbef4b4ce2ab6700",
88
"environmentVersionDescription": "",
99
"isPublic": true,
1010
"isDownloadable": true,
@@ -14,8 +14,8 @@
1414
"contextUrl": "https://github.com/datarobot/datarobot-user-models/tree/master/public_dropin_environments/python311",
1515
"imageRepository": "env-python",
1616
"tags": [
17-
"v11.2.0-68ddb0110008035274003e75",
18-
"68ddb0110008035274003e75",
17+
"v11.2.0-67a554bbfbef4b4ce2ab6700",
18+
"67a554bbfbef4b4ce2ab6700",
1919
"v11.2.0-latest"
2020
]
2121
}

0 commit comments

Comments
 (0)