Skip to content

Commit a964790

Browse files
authored
[Improve] Improve dockerfile pip source (#1484)
* [Improve] Improve dockerfile conda and pip source * Update Dockerfile * import cpu dockerfile
1 parent ab421f8 commit a964790

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

docker/CPU/Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ RUN curl -fsSL -v -o ~/miniconda.sh -O https://repo.anaconda.com/miniconda/Mini
4444
/opt/conda/bin/conda install -y python=${PYTHON_VERSION} conda-build pyyaml numpy ipython cython typing typing_extensions mkl mkl-include ninja && \
4545
/opt/conda/bin/conda clean -ya
4646

47+
### change the pip source for installing packages
48+
RUN if [ ${USE_SRC_INSIDE} == true ] ; \
49+
then \
50+
/opt/conda/bin/pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple; \
51+
echo "pip using tsinghua source" ; \
52+
else \
53+
echo "Keep pip the download source unchanged" ; \
54+
fi
55+
4756
### pytorch mmcv onnxruntime and openvino
4857
RUN /opt/conda/bin/pip install torch==${TORCH_VERSION}+cpu torchvision==${TORCHVISION_VERSION}+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html \
4958
&& /opt/conda/bin/pip install --no-cache-dir openmim

docker/GPU/Dockerfile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,19 @@ RUN curl -fsSL -v -o ~/miniconda.sh -O https://repo.anaconda.com/miniconda/Mini
3535
/opt/conda/bin/conda install -y python=${PYTHON_VERSION} conda-build pyyaml numpy ipython cython typing typing_extensions mkl mkl-include ninja && \
3636
/opt/conda/bin/conda clean -ya
3737

38+
### change the pip source for installing packages
39+
RUN if [ ${USE_SRC_INSIDE} == true ] ; \
40+
then \
41+
/opt/conda/bin/pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple; \
42+
echo "pip using tsinghua source" ; \
43+
else \
44+
echo "Keep pip the download source unchanged" ; \
45+
fi
46+
3847
### install pytorch openmim
3948
RUN /opt/conda/bin/conda install pytorch==${TORCH_VERSION} torchvision==${TORCHVISION_VERSION} cudatoolkit=${CUDA} -c pytorch -c conda-forge -y \
4049
&& /opt/conda/bin/pip install --no-cache-dir openmim
4150

42-
4351
### pytorch mmcv onnxruntime
4452
RUN /opt/conda/bin/mim install --no-cache-dir "mmcv"${MMCV_VERSION} onnxruntime-gpu==${ONNXRUNTIME_VERSION} mmengine${MMENGINE_VERSION}
4553

0 commit comments

Comments
 (0)