Skip to content

Update Dockerfile generation script #310

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 16 additions & 28 deletions tools/gen_ort_dockerfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ def dockerfile_for_linux(output_file):
gnupg1

RUN pip3 install patchelf==0.17.2 cmake==4.0.3

"""

if FLAGS.ort_openvino is not None:
Expand Down Expand Up @@ -268,11 +267,8 @@ def dockerfile_for_linux(output_file):
ARG ONNXRUNTIME_REPO
ARG ONNXRUNTIME_BUILD_CONFIG

# Cherry-pick commit: https://github.com/microsoft/onnxruntime/commit/9dad9af9f9b48c05814d0c2d067d0565e8da6ce8
RUN git clone -b rel-${ONNXRUNTIME_VERSION} --recursive ${ONNXRUNTIME_REPO} onnxruntime \\
&& cd onnxruntime \\
&& git cherry-pick -n 9dad9af9f9b48c05814d0c2d067d0565e8da6ce8 \\
&& sed -i 's/5ea4d05e62d7f954a46b3213f9b2535bdd866803/51982be81bbe52572b54180454df11a3ece9a934/g' cmake/deps.txt
# TODO: Switch to release branch
RUN git clone -b rel-${ONNXRUNTIME_VERSION} --recursive ${ONNXRUNTIME_REPO} onnxruntime
"""

if FLAGS.onnx_tensorrt_tag != "":
Expand Down Expand Up @@ -356,38 +352,30 @@ def dockerfile_for_linux(output_file):
# Copy all artifacts needed by the backend to /opt/onnxruntime
#
WORKDIR /opt/onnxruntime

RUN mkdir -p /opt/onnxruntime && \
cp /workspace/onnxruntime/LICENSE /opt/onnxruntime && \
cat /workspace/onnxruntime/cmake/external/onnx/VERSION_NUMBER > /opt/onnxruntime/ort_onnx_version.txt
RUN cp /workspace/onnxruntime/LICENSE . \\
&& cat /workspace/onnxruntime/cmake/external/onnx/VERSION_NUMBER > ort_onnx_version.txt

# ONNX Runtime headers, libraries and binaries
RUN mkdir -p /opt/onnxruntime/include && \
cp /workspace/onnxruntime/include/onnxruntime/core/session/onnxruntime_c_api.h \
/opt/onnxruntime/include && \
cp /workspace/onnxruntime/include/onnxruntime/core/session/onnxruntime_session_options_config_keys.h \
/opt/onnxruntime/include && \
cp /workspace/onnxruntime/include/onnxruntime/core/providers/cpu/cpu_provider_factory.h \
/opt/onnxruntime/include
WORKDIR /opt/onnxruntime/include
RUN cp /workspace/onnxruntime/include/onnxruntime/core/session/onnxruntime_c_api.h . \\
&& cp /workspace/onnxruntime/include/onnxruntime/core/session/onnxruntime_session_options_config_keys.h . \\
&& cp /workspace/onnxruntime/include/onnxruntime/core/providers/cpu/cpu_provider_factory.h . \\
&& cp /workspace/onnxruntime/include/onnxruntime/core/session/onnxruntime_ep_c_api.h .

RUN mkdir -p /opt/onnxruntime/lib && \
cp /workspace/build/${ONNXRUNTIME_BUILD_CONFIG}/libonnxruntime_providers_shared.so \
/opt/onnxruntime/lib && \
cp /workspace/build/${ONNXRUNTIME_BUILD_CONFIG}/libonnxruntime.so \
/opt/onnxruntime/lib
WORKDIR /opt/onnxruntime/lib
RUN cp /workspace/build/${ONNXRUNTIME_BUILD_CONFIG}/libonnxruntime_providers_shared.so . \\
&& cp /workspace/build/${ONNXRUNTIME_BUILD_CONFIG}/libonnxruntime.so .
"""
if target_platform() == "igpu":
df += """
RUN mkdir -p /opt/onnxruntime/bin
"""
else:
df += """
RUN mkdir -p /opt/onnxruntime/bin && \
cp /workspace/build/${ONNXRUNTIME_BUILD_CONFIG}/onnxruntime_perf_test \
/opt/onnxruntime/bin && \
cp /workspace/build/${ONNXRUNTIME_BUILD_CONFIG}/onnx_test_runner \
/opt/onnxruntime/bin && \
(cd /opt/onnxruntime/bin && chmod a+x *)
WORKDIR /opt/onnxruntime/bin
RUN cp /workspace/build/${ONNXRUNTIME_BUILD_CONFIG}/onnxruntime_perf_test . \\
&& cp /workspace/build/${ONNXRUNTIME_BUILD_CONFIG}/onnx_test_runner . \\
&& chmod a+x *
"""

if FLAGS.enable_gpu:
Expand Down
Loading