Skip to content

Commit

Permalink
In Dockerfile, do not install unecessary packages, use conda to insta…
Browse files Browse the repository at this point in the history
…ll ninja (saving one layer), and use "." to refer to WORKDIR to reduce redundancy. (#20881)

Summary:
- Do not install unecessary packages in the Docker image.
- In the Docker image, use conda to install ninja (saving one layer)
- When workdir is set, use "." to refer to it to reduce redundancy.
Pull Request resolved: pytorch/pytorch#20881

Differential Revision: D15495769

Pulled By: ezyang

fbshipit-source-id: dab7df71ac107c85fb1447697e25978daffc7e0b
  • Loading branch information
xuhdev authored and facebook-github-bot committed May 24, 2019
1 parent 6af2482 commit 4109ec1
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions docker/pytorch/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,20 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
cmake \
git \
curl \
vim \
ca-certificates \
libjpeg-dev \
libpng-dev &&\
libpng-dev && \
rm -rf /var/lib/apt/lists/*


RUN curl -o ~/miniconda.sh -O https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
chmod +x ~/miniconda.sh && \
~/miniconda.sh -b -p /opt/conda && \
rm ~/miniconda.sh && \
/opt/conda/bin/conda install -y python=$PYTHON_VERSION numpy pyyaml scipy ipython mkl mkl-include cython typing && \
/opt/conda/bin/conda install -y python=$PYTHON_VERSION numpy pyyaml scipy ipython mkl mkl-include ninja cython typing && \
/opt/conda/bin/conda install -y -c pytorch magma-cuda100 && \
/opt/conda/bin/conda clean -ya
ENV PATH /opt/conda/bin:$PATH
RUN pip install ninja
# This must be done before pip so that requirements.txt is available
WORKDIR /opt/pytorch
COPY . .
Expand All @@ -33,4 +31,4 @@ RUN TORCH_CUDA_ARCH_LIST="3.5 5.2 6.0 6.1 7.0+PTX" TORCH_NVCC_FLAGS="-Xfatbin -c
RUN git clone https://github.com/pytorch/vision.git && cd vision && pip install -v .

WORKDIR /workspace
RUN chmod -R a+w /workspace
RUN chmod -R a+w .

0 comments on commit 4109ec1

Please sign in to comment.