-
Notifications
You must be signed in to change notification settings - Fork 341
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Naren Dasan <naren@narendasan.com> Signed-off-by: Naren Dasan <narens@nvidia.com>
- Loading branch information
1 parent
0235491
commit 9b326e8
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
FROM nvcr.io/nvidia/pytorch:21.03-py3 | ||
|
||
RUN apt-get update && apt-get install -y curl gnupg && rm -rf /var/lib/apt/lists/* | ||
|
||
RUN curl -fsSL https://bazel.build/bazel-release.pub.gpg | gpg --dearmor > bazel.gpg | ||
RUN mv bazel.gpg /etc/apt/trusted.gpg.d/ | ||
RUN echo "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" | tee /etc/apt/sources.list.d/bazel.list | ||
|
||
RUN apt-get update && apt-get install -y bazel-4.0.0 && rm -rf /var/lib/apt/lists/* | ||
RUN ln -s /usr/bin/bazel-4.0.0 /usr/bin/bazel | ||
|
||
RUN pip install notebook | ||
|
||
COPY . /opt/trtorch | ||
RUN rm /opt/trtorch/WORKSPACE | ||
COPY ./docker/WORKSPACE.cu.docker /opt/trtorch/WORKSPACE | ||
|
||
# Workaround for bazel expecting both static and shared versions, we only use shared libraries inside container | ||
RUN cp /usr/lib/x86_64-linux-gnu/libnvinfer.so /usr/lib/x86_64-linux-gnu/libnvinfer_static.a | ||
|
||
WORKDIR /opt/trtorch | ||
RUN bazel build //:libtrtorch --compilation_mode opt | ||
|
||
WORKDIR /opt/trtorch/py | ||
|
||
RUN pip install ipywidgets --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org | ||
RUN jupyter nbextension enable --py widgetsnbextension | ||
|
||
# Locale is not set by default | ||
RUN apt-get update && apt-get install -y locales ninja-build && rm -rf /var/lib/apt/lists/* && locale-gen en_US.UTF-8 | ||
ENV LANG en_US.UTF-8 | ||
ENV LANGUAGE en_US:en | ||
ENV LC_ALL en_US.UTF-8 | ||
RUN python3 setup.py install --use-cxx11-abi | ||
|
||
RUN conda init bash | ||
|
||
ENV LD_LIBRARY_PATH /opt/conda/lib/python3.8/site-packages/torch/lib:$LD_LIBRARY_PATH | ||
|
||
WORKDIR /opt/trtorch/ | ||
CMD /bin/bash |