@@ -8,15 +8,20 @@ FROM base as torch-tensorrt-builder-base
88
99RUN rm -rf /opt/torch-tensorrt /usr/bin/bazel
1010
11- RUN apt-get update && apt-get install --no-install-recommends -y curl gnupg
12- RUN curl -fsSL https://bazel.build/bazel-release.pub.gpg | gpg --dearmor > /etc/apt/trusted.gpg.d/bazel.gpg
13- RUN echo "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" | tee /etc/apt/sources.list.d/bazel.list
11+ ARG ARCH= "x86_64"
12+ ARG TARGETARCH= "amd64"
13+ ARG BAZEL_VERSION=4.0.0
1414
15- RUN apt-get update && apt-get install -y --no-install-recommends bazel-4.0.0
16- RUN ln -s /usr/bin/bazel-4.0.0 /usr/bin/bazel
15+ RUN [[ "$TARGETARCH" == "amd64" ]] && ARCH="x86_64" || ARCH="${TARGETARCH}" \
16+ && wget -q https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-linux-${ARCH} -O /usr/bin/bazel \
17+ && chmod a+x /usr/bin/bazel
1718
1819# Workaround for bazel expecting both static and shared versions, we only use shared libraries inside container
19- RUN cp /usr/lib/x86_64-linux-gnu/libnvinfer.so /usr/lib/x86_64-linux-gnu/libnvinfer_static.a
20+ RUN touch /usr/lib/$HOSTTYPE-linux-gnu/libnvinfer_static.a
21+
22+ RUN rm -rf /usr/local/cuda/lib* /usr/local/cuda/include \
23+ && ln -sf /usr/local/cuda/targets/$HOSTTYPE-linux/lib /usr/local/cuda/lib64 \
24+ && ln -sf /usr/local/cuda/targets/$HOSTTYPE-linux/include /usr/local/cuda/include
2025
2126RUN apt-get update && apt-get install -y --no-install-recommends locales ninja-build && rm -rf /var/lib/apt/lists/* && locale-gen en_US.UTF-8
2227
@@ -47,7 +52,5 @@ ENV PATH /opt/conda/lib/python3.8/site-packages/torch_tensorrt/bin:${PATH}
4752
4853WORKDIR /workspace
4954RUN mv /workspace/torch_tensorrt /opt/pytorch/torch_tensorrt
50- RUN mkdir torch_tensorrt
51- RUN ln -s /opt/pytorch/torch_tensorrt/notebooks /workspace/torch_tensorrt/notebooks
5255
5356CMD /bin/bash
0 commit comments