diff --git a/docker/CPU/Dockerfile b/docker/CPU/Dockerfile index a7957fb26..b0268fd1b 100644 --- a/docker/CPU/Dockerfile +++ b/docker/CPU/Dockerfile @@ -43,6 +43,15 @@ RUN curl -fsSL -v -o ~/miniconda.sh -O https://repo.anaconda.com/miniconda/Mini /opt/conda/bin/conda install -y python=${PYTHON_VERSION} conda-build pyyaml numpy ipython cython typing typing_extensions mkl mkl-include ninja && \ /opt/conda/bin/conda clean -ya +### change the pip source for installing packages +RUN if [ ${USE_SRC_INSIDE} == true ] ; \ + then \ + /opt/conda/bin/pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple; \ + echo "pip using tsinghua source" ; \ + else \ + echo "Keep pip the download source unchanged" ; \ + fi + ### pytorch RUN /opt/conda/bin/pip install torch==${TORCH_VERSION}+cpu torchvision==${TORCHVISION_VERSION}+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html ENV PATH /opt/conda/bin:$PATH diff --git a/docker/GPU/Dockerfile b/docker/GPU/Dockerfile index fa9319289..fec4942d4 100644 --- a/docker/GPU/Dockerfile +++ b/docker/GPU/Dockerfile @@ -34,6 +34,15 @@ RUN curl -fsSL -v -o ~/miniconda.sh -O https://repo.anaconda.com/miniconda/Mini /opt/conda/bin/conda install -y python=${PYTHON_VERSION} conda-build pyyaml numpy ipython cython typing typing_extensions mkl mkl-include ninja && \ /opt/conda/bin/conda clean -ya +### change the pip source for installing packages +RUN if [ ${USE_SRC_INSIDE} == true ] ; \ + then \ + /opt/conda/bin/pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple; \ + echo "pip using tsinghua source" ; \ + else \ + echo "Keep pip the download source unchanged" ; \ + fi + ### pytorch RUN /opt/conda/bin/conda install pytorch==${TORCH_VERSION} torchvision==${TORCHVISION_VERSION} cudatoolkit=${CUDA} -c pytorch ENV PATH /opt/conda/bin:$PATH