From 4109ec12781a679b7eeb6d6d72768eb04a2a5af6 Mon Sep 17 00:00:00 2001 From: Hong Xu Date: Fri, 24 May 2019 09:16:18 -0700 Subject: [PATCH] In Dockerfile, do not install unecessary packages, use conda to install 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: https://github.com/pytorch/pytorch/pull/20881 Differential Revision: D15495769 Pulled By: ezyang fbshipit-source-id: dab7df71ac107c85fb1447697e25978daffc7e0b --- docker/pytorch/Dockerfile | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/docker/pytorch/Dockerfile b/docker/pytorch/Dockerfile index 368d5e71a169..3c7ede203eef 100644 --- a/docker/pytorch/Dockerfile +++ b/docker/pytorch/Dockerfile @@ -5,10 +5,9 @@ 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/* @@ -16,11 +15,10 @@ RUN curl -o ~/miniconda.sh -O https://repo.continuum.io/miniconda/Miniconda3-la 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 . . @@ -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 .