From 9bf1d939b4370842f38ec54c36e14c71ee37d23a Mon Sep 17 00:00:00 2001 From: MRXLT Date: Fri, 15 Nov 2019 11:49:13 +0800 Subject: [PATCH] add dockerfile for serving compile --- doc/DOCKER.md | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/INSTALL.md | 2 ++ 2 files changed, 86 insertions(+) create mode 100644 doc/DOCKER.md diff --git a/doc/DOCKER.md b/doc/DOCKER.md new file mode 100644 index 00000000..50377eed --- /dev/null +++ b/doc/DOCKER.md @@ -0,0 +1,84 @@ +#使用docker编译Paddle Serving + +## docker编译环境要求 + ++ 开发机上已安装docker ++ 编译GPU版本需要安装nvidia-docker + +## CPU版本dockerfile + +```bash +FROM centos:centos6.10 +RUN yum -y install wget \ + && wget http://people.centos.org/tru/devtools-2/devtools-2.repo -O /etc/yum.repos.d/devtoolset-2.repo \ + && yum -y install devtoolset-2-gcc devtoolset-2-gcc-c++ devtoolset-2-binutils \ + && source /opt/rh/devtoolset-2/enable \ + && echo "source /opt/rh/devtoolset-2/enable" >> /etc/profile \ + && yum -y install git openssl-devel curl-devel bzip2-devel \ + && wget https://cmake.org/files/v3.5/cmake-3.5.2.tar.gz \ + && tar xvf cmake-3.5.2.tar.gz \ + && cd cmake-3.5.2 \ + && ./bootstrap --prefix=/usr \ + && make \ + && make install \ + && cd .. \ + && rm -r cmake-3.5.2* \ + && wget https://dl.google.com/go/go1.12.12.linux-amd64.tar.gz \ + && tar -xzvf go1.12.12.linux-amd64.tar.gz \ + && mv go /usr/local/go \ + && rm go1.12.12.linux-amd64.tar.gz \ + && echo "export GOROOT=/usr/local/go" >> /root/.bashrc \ + && echo "export GOPATH=$HOME/go" >> /root/.bashrc \ + && echo "export PATH=$PATH:/usr/local/go/bin" >> /root/.bashrc +``` + + + +##GPU版本dockerfile + +```bash +FROM paddlepaddle/paddle_manylinux_devel:cuda9.0_cudnn7 +RUN yum -y install git openssl-devel curl-devel bzip2-devel \ + && wget https://dl.google.com/go/go1.12.12.linux-amd64.tar.gz \ + && tar -xzvf go1.12.12.linux-amd64.tar.gz \ + && rm -rf /usr/local/go \ + && mv go /usr/local/go \ + && rm go1.12.12.linux-amd64.tar.gz \ + && echo "GOROOT=/usr/local/go" >> /root/.bashrc \ + && echo "GOPATH=$HOME/go" >> /root/.bashrc \ + && echo "PATH=$PATH:$GOROOT/bin" >> /root/.bashrc +``` + + + +## 使用方法 + +###构建docker镜像 + +建立新目录,复制dockerfile内容到目录下dockerfile文件 + +执行 + +```bash +docker build -t serving_compile:cpu . +``` + +或者 + +```bash +docker build -t serving_compile:cuda9 . +``` + +## 进入docker + +CPU版本请执行 + +```bash +docker run -it serving_compile:cpu bash +``` + +GPU版本请执行 + +```bash +docker run -it --runtime=nvidia -it serving_compile:cuda9 bash +``` diff --git a/doc/INSTALL.md b/doc/INSTALL.md index 655d0347..ba6bcff2 100644 --- a/doc/INSTALL.md +++ b/doc/INSTALL.md @@ -16,6 +16,8 @@ openssl & openssl-devel ## 编译 +推荐使用docker编译Paddle Serving, [镜像dockerfile](./DOCKER.md) + ```shell $ git clone https://github.com/PaddlePaddle/serving.git $ cd serving -- GitLab