Fix docker build for users inside (#227)

* fix the related questions of Connection failed [IP: 91.189.88.152 80] or [IP: 91.189.88.142 80] in Dockerfile

* add an ARG to control whether to change the download source for GPU and CPU Dockerfile, and update corresponding changes to the documents

* add an ARG to control whether to change the download source for GPU and CPU Dockerfile, and update corresponding changes to the documents

* update documentation

* update documentation

* fix lint error

Co-authored-by: zhangwenjun <zhangwenjun@clustar.ai>
pull/257/head
张文俊 2022-03-17 21:25:25 +08:00 committed by GitHub
parent ea54f3b2fd
commit 51e003bec5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 45 additions and 0 deletions

View File

@ -6,6 +6,18 @@ ARG ONNXRUNTIME_VERSION=1.8.1
ARG MMCV_VERSION=1.4.0
ARG CMAKE_VERSION=3.20.0
USER root
### change the system source for installing libs
ARG USE_SRC_INSIDE=false
RUN if [ ${USE_SRC_INSIDE} == true ] ; \
then \
sed -i s/archive.ubuntu.com/mirrors.aliyun.com/g /etc/apt/sources.list ; \
sed -i s/security.ubuntu.com/mirrors.aliyun.com/g /etc/apt/sources.list ; \
echo "Use aliyun source for installing libs" ; \
else \
echo "Keep the download source unchanged" ; \
fi
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
libopencv-dev libspdlog-dev \

View File

@ -12,6 +12,17 @@ ENV FORCE_CUDA="1"
ENV DEBIAN_FRONTEND=noninteractive
### change the system source for installing libs
ARG USE_SRC_INSIDE=false
RUN if [ ${USE_SRC_INSIDE} == true ] ; \
then \
sed -i s/archive.ubuntu.com/mirrors.aliyun.com/g /etc/apt/sources.list ; \
sed -i s/security.ubuntu.com/mirrors.aliyun.com/g /etc/apt/sources.list ; \
echo "Use aliyun source for installing libs" ; \
else \
echo "Keep the download source unchanged" ; \
fi
### update apt and install libs
RUN apt-get update &&\
apt-get install -y vim libsm6 libxext6 libxrender-dev libgl1-mesa-glx git wget libssl-dev libopencv-dev libspdlog-dev --no-install-recommends &&\

View File

@ -21,6 +21,17 @@ cd mmdeploy
docker build docker/GPU/ -t mmdeploy:0.1.0 --build-arg VERSION=0.1.0
```
For installing libs with the aliyun source, we can append `--build-arg USE_SRC_INSIDE=${USE_SRC_INSIDE}` to build command.
```
# GPU for example
cd mmdeploy
docker build docker/GPU/ -t mmdeploy:inside --build-arg USE_SRC_INSIDE=true
# CPU for example
cd mmdeploy
docker build docker/CPU/ -t mmdeploy:inside --build-arg USE_SRC_INSIDE=true
```
### Run docker container
After building the docker image succeed, we can use `docker run` to launch the docker service. GPU docker image for example:

View File

@ -21,6 +21,17 @@ cd mmdeploy
docker build docker/GPU/ -t mmdeploy:0.1.0 --build-arg VERSION=0.1.0
```
要切换成阿里源安装依赖,我们可以将 `--build-arg USE_SRC_INSIDE=${USE_SRC_INSIDE}` 附加到构建命令中。
```
# 以 GPU 为例
cd mmdeploy
docker build docker/GPU/ -t mmdeploy:inside --build-arg USE_SRC_INSIDE=true
# 以 CPU 为例
cd mmdeploy
docker build docker/CPU/ -t mmdeploy:inside --build-arg USE_SRC_INSIDE=true
```
### 运行 docker 容器
构建 docker 镜像成功后,我们可以使用 `docker run` 启动 docker 服务。 GPU 镜像为例: