Skip to content

Commit 0da3363

Browse files
committed
TPRD-1595: Update dockerfile configuation
1 parent 604ee7a commit 0da3363

File tree

1 file changed

+17
-29
lines changed

1 file changed

+17
-29
lines changed

tools/gen_ort_dockerfile.py

Lines changed: 17 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env python3
2-
# Copyright 2020-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# Copyright 2020-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
33
#
44
# Redistribution and use in source and binary forms, with or without
55
# modification, are permitted provided that the following conditions
@@ -178,7 +178,6 @@ def dockerfile_for_linux(output_file):
178178
gnupg1
179179
180180
RUN pip3 install patchelf==0.17.2 cmake==4.0.3
181-
182181
"""
183182

184183
if FLAGS.ort_openvino is not None:
@@ -268,11 +267,8 @@ def dockerfile_for_linux(output_file):
268267
ARG ONNXRUNTIME_REPO
269268
ARG ONNXRUNTIME_BUILD_CONFIG
270269
271-
# Cherry-pick commit: https://github.com/microsoft/onnxruntime/commit/9dad9af9f9b48c05814d0c2d067d0565e8da6ce8
272-
RUN git clone -b rel-${ONNXRUNTIME_VERSION} --recursive ${ONNXRUNTIME_REPO} onnxruntime \\
273-
&& cd onnxruntime \\
274-
&& git cherry-pick -n 9dad9af9f9b48c05814d0c2d067d0565e8da6ce8 \\
275-
&& sed -i 's/5ea4d05e62d7f954a46b3213f9b2535bdd866803/51982be81bbe52572b54180454df11a3ece9a934/g' cmake/deps.txt
270+
# TODO: Switch to release branch
271+
RUN git clone -b main --recursive ${ONNXRUNTIME_REPO} onnxruntime
276272
"""
277273

278274
if FLAGS.onnx_tensorrt_tag != "":
@@ -356,38 +352,30 @@ def dockerfile_for_linux(output_file):
356352
# Copy all artifacts needed by the backend to /opt/onnxruntime
357353
#
358354
WORKDIR /opt/onnxruntime
359-
360-
RUN mkdir -p /opt/onnxruntime && \
361-
cp /workspace/onnxruntime/LICENSE /opt/onnxruntime && \
362-
cat /workspace/onnxruntime/cmake/external/onnx/VERSION_NUMBER > /opt/onnxruntime/ort_onnx_version.txt
355+
RUN cp /workspace/onnxruntime/LICENSE . \\
356+
&& cat /workspace/onnxruntime/cmake/external/onnx/VERSION_NUMBER > ort_onnx_version.txt
363357
364358
# ONNX Runtime headers, libraries and binaries
365-
RUN mkdir -p /opt/onnxruntime/include && \
366-
cp /workspace/onnxruntime/include/onnxruntime/core/session/onnxruntime_c_api.h \
367-
/opt/onnxruntime/include && \
368-
cp /workspace/onnxruntime/include/onnxruntime/core/session/onnxruntime_session_options_config_keys.h \
369-
/opt/onnxruntime/include && \
370-
cp /workspace/onnxruntime/include/onnxruntime/core/providers/cpu/cpu_provider_factory.h \
371-
/opt/onnxruntime/include
359+
WORKDIR /opt/onnxruntime/include
360+
RUN cp /workspace/onnxruntime/include/onnxruntime/core/session/onnxruntime_c_api.h . \\
361+
&& cp /workspace/onnxruntime/include/onnxruntime/core/session/onnxruntime_session_options_config_keys.h . \\
362+
&& cp /workspace/onnxruntime/include/onnxruntime/core/providers/cpu/cpu_provider_factory.h . \\
363+
&& cp /workspace/onnxruntime/include/onnxruntime/core/session/onnxruntime_ep_c_api.h .
372364
373-
RUN mkdir -p /opt/onnxruntime/lib && \
374-
cp /workspace/build/${ONNXRUNTIME_BUILD_CONFIG}/libonnxruntime_providers_shared.so \
375-
/opt/onnxruntime/lib && \
376-
cp /workspace/build/${ONNXRUNTIME_BUILD_CONFIG}/libonnxruntime.so \
377-
/opt/onnxruntime/lib
365+
WORKDIR /opt/onnxruntime/lib
366+
RUN cp /workspace/build/${ONNXRUNTIME_BUILD_CONFIG}/libonnxruntime_providers_shared.so . \\
367+
&& cp /workspace/build/${ONNXRUNTIME_BUILD_CONFIG}/libonnxruntime.so .
378368
"""
379369
if target_platform() == "igpu":
380370
df += """
381371
RUN mkdir -p /opt/onnxruntime/bin
382372
"""
383373
else:
384374
df += """
385-
RUN mkdir -p /opt/onnxruntime/bin && \
386-
cp /workspace/build/${ONNXRUNTIME_BUILD_CONFIG}/onnxruntime_perf_test \
387-
/opt/onnxruntime/bin && \
388-
cp /workspace/build/${ONNXRUNTIME_BUILD_CONFIG}/onnx_test_runner \
389-
/opt/onnxruntime/bin && \
390-
(cd /opt/onnxruntime/bin && chmod a+x *)
375+
WORKDIR /opt/onnxruntime/bin
376+
RUN cp /workspace/build/${ONNXRUNTIME_BUILD_CONFIG}/onnxruntime_perf_test . \\
377+
&& cp /workspace/build/${ONNXRUNTIME_BUILD_CONFIG}/onnx_test_runner . \\
378+
&& chmod a+x *
391379
"""
392380

393381
if FLAGS.enable_gpu:

0 commit comments

Comments
 (0)