Skip to content

Commit

Permalink
feat(//docker): Adding Docker 21.03
Browse files Browse the repository at this point in the history
Signed-off-by: Naren Dasan <naren@narendasan.com>
Signed-off-by: Naren Dasan <narens@nvidia.com>
  • Loading branch information
narendasan committed May 12, 2021
1 parent 0235491 commit 9b326e8
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions docker/Dockerfile.21.03
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

0 comments on commit 9b326e8

Please sign in to comment.