Skip to content

Commit

Permalink
Move protobuf requirement to docker-specific requirements.txt (#1092)
Browse files Browse the repository at this point in the history
Co-authored-by: adriangonz <[email protected]>
  • Loading branch information
Adrian Gonzalez-Martin and adriangonz authored Apr 14, 2023
1 parent 85ac2e8 commit 3cec437
Show file tree
Hide file tree
Showing 15 changed files with 27 additions and 16 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ RUN useradd -u 1000 -s /bin/bash mlserver -d $MLSERVER_PATH && \
chmod -R 776 $MLSERVER_PATH

COPY --from=wheel-builder /opt/mlserver/dist ./dist
COPY ./requirements/docker.txt ./requirements/docker.txt
# NOTE: if runtime is "all" we install mlserver-<version>-py3-none-any.whl
# we have to use this syntax to return the correct file: $(ls ./dist/mlserver-*.whl)
# NOTE: Temporarily excluding mllib from the main image due to:
Expand All @@ -90,6 +91,7 @@ RUN . $CONDA_PATH/etc/profile.d/conda.sh && \
done \
fi && \
pip install $(ls "./dist/mlserver-"*.whl) && \
pip install -r ./requirements/docker.txt && \
rm -f /opt/conda/lib/python3.8/site-packages/spacy/tests/package/requirements.txt && \
rm -rf /root/.cache/pip

Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ install-dev:
fi \
done
pip install --editable .
pip install -r ./requirements/docker.txt

_generate: # "private" target to call `fmt` after `generate`
./hack/generate-types.sh
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
author = "Seldon Technologies"

# The full version, including alpha/beta/rc tags
release = "1.3.0.dev13"
release = "1.3.0.dev14"


# -- General configuration ---------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion mlserver/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.3.0.dev13"
__version__ = "1.3.0.dev14"
3 changes: 3 additions & 0 deletions requirements/docker.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Force patch for CVE-2022-1941
# Otherwise, TF <2.12 will force a vulnerable version of `protobuf`
protobuf==3.20.3
2 changes: 1 addition & 1 deletion runtimes/alibi-detect/mlserver_alibi_detect/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.3.0.dev13"
__version__ = "1.3.0.dev14"
2 changes: 1 addition & 1 deletion runtimes/alibi-explain/mlserver_alibi_explain/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.3.0.dev13"
__version__ = "1.3.0.dev14"
2 changes: 1 addition & 1 deletion runtimes/huggingface/mlserver_huggingface/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.3.0.dev13"
__version__ = "1.3.0.dev14"
2 changes: 1 addition & 1 deletion runtimes/lightgbm/mlserver_lightgbm/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.3.0.dev13"
__version__ = "1.3.0.dev14"
2 changes: 1 addition & 1 deletion runtimes/mlflow/mlserver_mlflow/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.3.0.dev13"
__version__ = "1.3.0.dev14"
2 changes: 1 addition & 1 deletion runtimes/mllib/mlserver_mllib/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.3.0.dev13"
__version__ = "1.3.0.dev14"
2 changes: 1 addition & 1 deletion runtimes/sklearn/mlserver_sklearn/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.3.0.dev13"
__version__ = "1.3.0.dev14"
2 changes: 1 addition & 1 deletion runtimes/xgboost/mlserver_xgboost/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.3.0.dev13"
__version__ = "1.3.0.dev14"
13 changes: 10 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ envlist =
deps =
-e{toxinidir}
-r{toxinidir}/requirements/dev.txt
-r{toxinidir}/requirements/docker.txt
commands =
# Upgrade setuptools, pip and wheel to ensure we mimic the Docker image's
# environment
Expand All @@ -47,6 +48,7 @@ deps =
-e{toxinidir}
-e{toxinidir}/runtimes/sklearn
-r{toxinidir}/requirements/dev.txt
-r{toxinidir}/requirements/docker.txt
commands =
pip install --upgrade setuptools pip wheel
python -m pytest {posargs} {toxinidir}/runtimes/sklearn
Expand All @@ -56,6 +58,7 @@ deps =
-e{toxinidir}
-e{toxinidir}/runtimes/xgboost
-r{toxinidir}/requirements/dev.txt
-r{toxinidir}/requirements/docker.txt
commands =
pip install --upgrade setuptools pip wheel
python -m pytest {posargs} {toxinidir}/runtimes/xgboost
Expand All @@ -65,6 +68,7 @@ deps =
-e{toxinidir}
-e{toxinidir}/runtimes/lightgbm
-r{toxinidir}/requirements/dev.txt
-r{toxinidir}/requirements/docker.txt
commands =
pip install --upgrade setuptools pip wheel
python -m pytest {posargs} {toxinidir}/runtimes/lightgbm
Expand All @@ -74,6 +78,7 @@ deps =
-e{toxinidir}
-e{toxinidir}/runtimes/mlflow
-r{toxinidir}/requirements/dev.txt
-r{toxinidir}/requirements/docker.txt
-r{toxinidir}/runtimes/mlflow/requirements/dev.txt
commands =
pip install --upgrade setuptools pip wheel
Expand All @@ -86,7 +91,7 @@ deps =
commands =
# Avoid conflicts and ensure `protobuf==3.20.3` is used (CVE-2022-1941)
# https://github.com/huggingface/optimum/issues/733
pip install -e{toxinidir}
pip install -e{toxinidir} -r{toxinidir}/requirements/docker.txt
pip install --upgrade setuptools pip wheel
python -m pytest {posargs} {toxinidir}/runtimes/huggingface

Expand All @@ -95,6 +100,7 @@ deps =
-e{toxinidir}/runtimes/alibi-explain
-e{toxinidir}
-r{toxinidir}/requirements/dev.txt
-r{toxinidir}/requirements/docker.txt
-r{toxinidir}/runtimes/alibi-explain/requirements/dev.txt
setenv =
CUDA_VISIBLE_DEVICES =
Expand All @@ -111,7 +117,7 @@ setenv =
CUDA_VISIBLE_DEVICES =
commands =
# Avoid conflicts and ensure `protobuf==3.20.3` is used (CVE-2022-1941)
pip install -e{toxinidir}
pip install -e{toxinidir} -r{toxinidir}/requirements/docker.txt
pip install --upgrade setuptools pip wheel
python -m pytest {posargs} {toxinidir}/runtimes/alibi-detect

Expand All @@ -135,7 +141,8 @@ commands =
pip install \
# Avoid conflicts with TF to ensure `protobuf==3.20.3` is used
# (CVE-2022-1941)
-e{toxinidir}
-e{toxinidir} \
-r{toxinidir}/requirements/docker.txt
python -m pytest {posargs} \
{toxinidir}/tests \
{toxinidir}/runtimes/alibi-explain \
Expand Down
4 changes: 1 addition & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ def _load_description() -> str:
"importlib-resources",
"numpy",
"pandas",
# Force patch for CVE-2022-1941
# https://github.com/huggingface/optimum/issues/733
"protobuf == 3.20.3",
"protobuf",
"uvicorn",
"starlette_exporter",
"py-grpc-prometheus",
Expand Down

0 comments on commit 3cec437

Please sign in to comment.