Skip to content

Commit cc7e8cc

Browse files
author
Changming Sun
authored
Update dockerfiles/Dockerfile.source to avoid installing onnx (#17975)
### Description Update dockerfiles/Dockerfile.source to avoid installing onnx python package. ONNX is not listed in https://github.com/microsoft/onnxruntime/blob/main/requirements.txt.in. We do not have to install it. Especially when we do not run tests, the package provides no help when building onnxruntime from source. ### Motivation and Context Resolve #17781
1 parent 99b8dca commit cc7e8cc

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

dockerfiles/Dockerfile.source

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ FROM mcr.microsoft.com/cbl-mariner/base/python:3
88
MAINTAINER Changming Sun "chasun@microsoft.com"
99
ADD . /code
1010

11-
RUN tdnf install -y tar ca-certificates build-essential python3-numpy cmake python3-setuptools python3-wheel python3-pip curl python3-devel
11+
RUN tdnf install -y tar ca-certificates build-essential cmake curl python3-devel python3-setuptools python3-wheel python3-pip python3-numpy python3-flatbuffers python3-packaging python3-protobuf
12+
# The latest cmake version in Mariner2 is 3.21, but we need 3.26+
1213
RUN /code/dockerfiles/scripts/install_cmake.sh
1314

1415
# Prepare onnxruntime repository & build onnxruntime
15-
RUN cd /code && python3 -m pip install -r tools/ci_build/github/linux/docker/inference/x64/python/cpu/scripts/requirements.txt && /bin/bash ./build.sh --allow_running_as_root --skip_submodule_sync --config Release --build_wheel --update --build --parallel --cmake_extra_defines ONNXRUNTIME_VERSION=$(cat ./VERSION_NUMBER)
16+
RUN cd /code && /bin/bash ./build.sh --allow_running_as_root --skip_submodule_sync --config Release --build_wheel --update --build --parallel --cmake_extra_defines ONNXRUNTIME_VERSION=$(cat ./VERSION_NUMBER)
1617

1718
FROM mcr.microsoft.com/cbl-mariner/base/python:3
1819
COPY --from=0 /code/build/Linux/Release/dist /root
1920
COPY --from=0 /code/dockerfiles/LICENSE-IMAGE.txt /code/LICENSE-IMAGE.txt
20-
RUN tdnf install -y ca-certificates python3-setuptools python3-wheel python3-pip && python3 -m pip install /root/*.whl && rm -rf /root/*.whl
21+
RUN tdnf install -y ca-certificates python3-setuptools python3-wheel python3-pip python3-numpy python3-flatbuffers python3-packaging python3-protobuf python3-mpmath python3-sympy && python3 -m pip install coloredlogs humanfriendly && python3 -m pip install --no-index --find-links /root onnxruntime && rm -rf /root/*.whl

0 commit comments

Comments
 (0)