Skip to content

Commit 98ef865

Browse files
authored
Enable remote cache if applicable (#297)
* Add caching mechanism * Add ccache to CUDA and C * Enable verbose output for ORT * Update cache installation * Update Dockerfile instructions * Fix pre-commit issue
1 parent 48f3794 commit 98ef865

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tools/gen_ort_dockerfile.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,22 @@ def dockerfile_for_linux(output_file):
132132
RUN pip3 install patchelf==0.17.2
133133
"""
134134
else:
135+
if os.getenv("CCACHE_REMOTE_ONLY") and os.getenv("CCACHE_REMOTE_STORAGE"):
136+
df += """
137+
ENV CCACHE_REMOTE_ONLY="true" \\
138+
CCACHE_REMOTE_STORAGE="{}" \\
139+
CMAKE_CXX_COMPILER_LAUNCHER="ccache" \\
140+
CMAKE_C_COMPILER_LAUNCHER="ccache" \\
141+
CMAKE_CUDA_COMPILER_LAUNCHER="ccache" \\
142+
VERBOSE=1
143+
144+
RUN apt-get update \\
145+
&& apt-get install -y --no-install-recommends ccache && ccache -p \\
146+
&& rm -rf /var/lib/apt/lists/*
147+
""".format(
148+
os.getenv("CCACHE_REMOTE_STORAGE")
149+
)
150+
135151
df += """
136152
137153
RUN apt-get update && apt-get install -y --no-install-recommends \

0 commit comments

Comments
 (0)