Skip to content

Commit 7bac2cd

Browse files
authored
[RAPTOR-14742] PDIE: All without pip (#1693)
This is for all relevant public dropin environments. This drops the pip install and update that happens, preferring to rely on the system installed pip. This is currently to address CVE-2025-8869, which upstream pip has fixed but has not released yet, and its release date is undetermined at this time. Chainguard however has fixed this in their images, so pip installing from pypi is re-introducing the vulnerability into our images. Relying on system site packages, especially for pip, allows us to use the fixes from Chainguard without re-introducing them.
1 parent c81f103 commit 7bac2cd

File tree

21 files changed

+55
-67
lines changed

21 files changed

+55
-67
lines changed

public_dropin_environments/java_codegen/Dockerfile

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

3939
# Required for custom-models to install dependencies
4040
COPY --from=build /usr/bin/pip /usr/bin/pip
41+
COPY --from=build /usr/lib/python3.11/site-packages/pip /usr/lib/python3.11/site-packages/pip
4142

4243
# Cleanup '__pycache__' directories. It solves an AsymmetricPrivateKey scanning error.
4344
COPY --from=build /usr/bin/rm /usr/bin/rm
@@ -51,11 +52,9 @@ COPY requirements.txt requirements.txt
5152

5253
ENV VIRTUAL_ENV=/opt/venv
5354

54-
RUN sh -c "python -m venv ${VIRTUAL_ENV} && \
55+
RUN sh -c "/usr/bin/python -m venv --without-pip ${VIRTUAL_ENV} && \
5556
. ${VIRTUAL_ENV}/bin/activate && \
56-
python -m ensurepip --default-pip && \
57-
python -m pip install --upgrade pip && \
58-
python -m pip install --no-cache-dir -r requirements.txt && \
57+
/usr/bin/python -m pip install --no-cache-dir -r requirements.txt && \
5958
find ${VIRTUAL_ENV} -type d -name '__pycache__' -exec rm -rf {} +"
6059

6160
ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk

public_dropin_environments/java_codegen/Dockerfile.local

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@ COPY requirements.txt requirements.txt
1010

1111
ENV VIRTUAL_ENV=/opt/venv
1212

13-
RUN sh -c "python -m venv ${VIRTUAL_ENV} && \
13+
RUN sh -c "/usr/local/bin/python -m venv --without-pip ${VIRTUAL_ENV} && \
1414
. ${VIRTUAL_ENV}/bin/activate && \
15-
python -m pip install --upgrade pip && \
16-
python -m pip install --no-cache-dir -r requirements.txt"
15+
/usr/local/bin/python -m pip install --no-cache-dir -r requirements.txt"
1716

1817
ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk
1918
ENV PATH=${VIRTUAL_ENV}/bin:${JAVA_HOME}/bin:${PATH}

public_dropin_environments/java_codegen/env_info.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "This template can be used as an environment for DataRobot generated scoring code or models that implement the either the IClassificationPredictor or IRegressionPredictor interface from the datarobot-prediction package and for H2O models exported as POJO or MOJO.",
55
"programmingLanguage": "java",
66
"label": "",
7-
"environmentVersionId": "68e3bdab0001b95872004bd0",
7+
"environmentVersionId": "68e41996007f106aa4001fc1",
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/java_codegen",
1515
"imageRepository": "env-java-codegen",
1616
"tags": [
17-
"v11.2.0-68e3bdab0001b95872004bd0",
18-
"68e3bdab0001b95872004bd0",
17+
"v11.2.0-68e41996007f106aa4001fc1",
18+
"68e41996007f106aa4001fc1",
1919
"v11.2.0-latest"
2020
]
2121
}

public_dropin_environments/python311/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ COPY requirements.txt requirements.txt
4343

4444
ENV VIRTUAL_ENV=/opt/venv
4545

46-
RUN sh -c "python -m venv --without-pip --system-site-packages ${VIRTUAL_ENV} && \
46+
RUN sh -c "/usr/bin/python -m venv --without-pip ${VIRTUAL_ENV} && \
4747
. ${VIRTUAL_ENV}/bin/activate && \
48-
python -m pip install --no-cache-dir -r requirements.txt && \
48+
/usr/bin/python -m pip install --no-cache-dir -r requirements.txt && \
4949
find ${VIRTUAL_ENV} -type d -name '__pycache__' -exec rm -rf {} +"
5050

5151
ENV PATH=${VIRTUAL_ENV}/bin:${PATH}

public_dropin_environments/python311/Dockerfile.local

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ COPY requirements.txt requirements.txt
1010

1111
ENV VIRTUAL_ENV=/opt/venv
1212

13-
RUN sh -c "python -m venv --without-pip --system-site-packages ${VIRTUAL_ENV} && \
13+
RUN sh -c "/usr/local/bin/python -m venv --without-pip ${VIRTUAL_ENV} && \
1414
. ${VIRTUAL_ENV}/bin/activate && \
15-
python -m pip install --no-cache-dir -r requirements.txt"
15+
/usr/local/bin/python -m pip install --no-cache-dir -r requirements.txt"
1616

1717
ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk
1818
ENV PATH=${VIRTUAL_ENV}/bin:${PATH}

public_dropin_environments/python311/env_info.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
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": "68e3bdab007b737254004989",
7+
"environmentVersionId": "68e4519c2054621259094e94",
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-68e3bdab007b737254004989",
18-
"68e3bdab007b737254004989",
17+
"v11.2.0-68e4519c2054621259094e94",
18+
"68e4519c2054621259094e94",
1919
"v11.2.0-latest"
2020
]
2121
}

public_dropin_environments/python3_keras/Dockerfile

Lines changed: 3 additions & 4 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
@@ -42,11 +43,9 @@ COPY requirements.txt requirements.txt
4243

4344
ENV VIRTUAL_ENV=/opt/venv
4445

45-
RUN sh -c "python -m venv ${VIRTUAL_ENV} && \
46+
RUN sh -c "/usr/bin/python -m venv --without-pip ${VIRTUAL_ENV} && \
4647
. ${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 && \
48+
/usr/bin/python -m pip install --no-cache-dir -r requirements.txt && \
5049
find ${VIRTUAL_ENV} -type d -name '__pycache__' -exec rm -rf {} +"
5150

5251
ENV PATH=${VIRTUAL_ENV}/bin:${PATH}

public_dropin_environments/python3_keras/Dockerfile.local

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@ ENV VIRTUAL_ENV=/opt/venv
88

99
COPY requirements.txt requirements.txt
1010

11-
RUN sh -c "python -m venv ${VIRTUAL_ENV} && \
11+
RUN sh -c "/usr/local/bin/python -m venv --without-pip ${VIRTUAL_ENV} && \
1212
. ${VIRTUAL_ENV}/bin/activate && \
13-
python -m pip install --upgrade pip && \
14-
python -m pip install --no-cache-dir -r requirements.txt"
13+
/usr/local/bin/python -m pip install --no-cache-dir -r requirements.txt"
1514

1615
ENV PATH=${VIRTUAL_ENV}/bin:${PATH}
1716
ENV HOME=/opt

public_dropin_environments/python3_keras/env_info.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "This template environment can be used to create artifact-only keras custom models. This environment contains keras backed by tensorflow and only requires your model artifact as a .h5 file and optionally a custom.py file.",
55
"programmingLanguage": "python",
66
"label": "",
7-
"environmentVersionId": "68e3bdab00153a1176005098",
7+
"environmentVersionId": "68e41c500025331a640064a6",
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/python3_keras",
1515
"imageRepository": "env-python-keras",
1616
"tags": [
17-
"v11.2.0-68e3bdab00153a1176005098",
18-
"68e3bdab00153a1176005098",
17+
"v11.2.0-68e41c500025331a640064a6",
18+
"68e41c500025331a640064a6",
1919
"v11.2.0-latest"
2020
]
2121
}

public_dropin_environments/python3_onnx/Dockerfile

Lines changed: 3 additions & 4 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
@@ -42,11 +43,9 @@ COPY requirements.txt requirements.txt
4243

4344
ENV VIRTUAL_ENV=/opt/venv
4445

45-
RUN sh -c "python -m venv ${VIRTUAL_ENV} && \
46+
RUN sh -c "/usr/bin/python -m venv --without-pip ${VIRTUAL_ENV} && \
4647
. ${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 && \
48+
/usr/bin/python -m pip install --no-cache-dir -r requirements.txt && \
5049
find ${VIRTUAL_ENV} -type d -name '__pycache__' -exec rm -rf {} +"
5150

5251
ENV PATH=${VIRTUAL_ENV}/bin:${PATH}

0 commit comments

Comments
 (0)