Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Serving
提交
37967fcb
S
Serving
项目概览
PaddlePaddle
/
Serving
大约 1 年 前同步成功
通知
186
Star
833
Fork
253
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
105
列表
看板
标记
里程碑
合并请求
10
Wiki
2
Wiki
分析
仓库
DevOps
项目成员
Pages
S
Serving
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
105
Issue
105
列表
看板
标记
里程碑
合并请求
10
合并请求
10
Pages
分析
分析
仓库分析
DevOps
Wiki
2
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
37967fcb
编写于
4月 16, 2021
作者:
W
wangjiawei04
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
support running docker images
上级
ed938a1a
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
231 addition
and
0 deletion
+231
-0
tools/Dockerfile.runtime_template
tools/Dockerfile.runtime_template
+56
-0
tools/dockerfile/build_scripts/install_gcc.sh
tools/dockerfile/build_scripts/install_gcc.sh
+1
-0
tools/dockerfile/build_scripts/install_python.sh
tools/dockerfile/build_scripts/install_python.sh
+38
-0
tools/dockerfile/build_scripts/install_whl.sh
tools/dockerfile/build_scripts/install_whl.sh
+56
-0
tools/generate_runtime_docker.sh
tools/generate_runtime_docker.sh
+80
-0
未找到文件。
tools/Dockerfile.runtime_template
0 → 100644
浏览文件 @
37967fcb
# Dockerfile template
FROM <<base_image>>
RUN apt-get update && \
apt-get install -y make build-essential
RUN apt-get update && \
apt-get install -y wget tar xz-utils bzip2 libcurl4-openssl-dev \
curl sed grep zlib1g-dev libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev && \
apt-get clean -y
WORKDIR /usr/bin
COPY tools/dockerfile/build_scripts /build_scripts
RUN bash /build_scripts/install_gcc.sh gcc82 && rm -rf /build_scripts
RUN cp gcc gcc.bak && cp g++ g++.bak && rm gcc && rm g++
RUN ln -s /usr/local/gcc-8.2/bin/gcc /usr/local/bin/gcc
RUN ln -s /usr/local/gcc-8.2/bin/g++ /usr/local/bin/g++
RUN ln -s /usr/local/gcc-8.2/bin/gcc /usr/bin/gcc
RUN ln -s /usr/local/gcc-8.2/bin/g++ /usr/bin/g++
ENV PATH=/usr/local/gcc-8.2/bin:$PATH
# install python
WORKDIR /home
COPY tools/dockerfile/build_scripts /build_scripts
RUN bash /build_scripts/install_python.sh <<python_version>> && rm -rf /build_scripts
# Other
# install whl and bin
WORKDIR /home
COPY tools/dockerfile/build_scripts /build_scripts
RUN bash /build_scripts/install_whl.sh 0.5.0 2.0.0 <<run_env>> <<python_version>> && rm -rf /build_scripts
# install tensorrt
WORKDIR /home
COPY tools/dockerfile/build_scripts /build_scripts
RUN bash /build_scripts/install_trt.sh && rm -rf /build_scripts
# install go
RUN wget -qO- https://dl.google.com/go/go1.14.linux-amd64.tar.gz | \
tar -xz -C /usr/local && \
mkdir /root/go && \
mkdir /root/go/bin && \
mkdir /root/go/src && \
echo "GOROOT=/usr/local/go" >> /root/.bashrc && \
echo "GOPATH=/root/go" >> /root/.bashrc && \
echo "PATH=/usr/local/go/bin:/root/go/bin:$PATH" >> /root/.bashrc
RUN wget https://paddle-serving.bj.bcebos.com/others/centos_ssl.tar && \
tar xf centos_ssl.tar && rm -rf centos_ssl.tar && \
mv libcrypto.so.1.0.2k /usr/lib/libcrypto.so.1.0.2k && mv libssl.so.1.0.2k /usr/lib/libssl.so.1.0.2k && \
ln -sf /usr/lib/libcrypto.so.1.0.2k /usr/lib/libcrypto.so.10 && \
ln -sf /usr/lib/libssl.so.1.0.2k /usr/lib/libssl.so.10 && \
ln -sf /usr/lib/libcrypto.so.10 /usr/lib/libcrypto.so && \
ln -sf /usr/lib/libssl.so.10 /usr/lib/libssl.so
EXPOSE 22
tools/dockerfile/build_scripts/install_gcc.sh
浏览文件 @
37967fcb
...
...
@@ -39,6 +39,7 @@ if [ "$1" == "gcc82" ]; then
../gcc-8.2.0/configure
--prefix
=
/usr/local/gcc-8.2
--enable-threads
=
posix
--disable-checking
--disable-multilib
&&
\
make
-j8
&&
make
install
cd
..
&&
rm
-rf
temp_gcc82
rm
-rf
gcc-8.2.0 gcc-8.2.0.tar.xz
cp
${
lib_so_6
}
${
lib_so_6
}
.bak
&&
rm
-f
${
lib_so_6
}
&&
ln
-s
/usr/local/gcc-8.2/lib64/libgfortran.so.5
${
lib_so_5
}
&&
\
ln
-s
/usr/local/gcc-8.2/lib64/libstdc++.so.6
${
lib_so_6
}
&&
\
...
...
tools/dockerfile/build_scripts/install_python.sh
0 → 100644
浏览文件 @
37967fcb
#!/bin/bash
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
VERSION
=
$1
if
[[
"
$VERSION
"
==
"2.7"
]]
;
then
wget
-q
https://www.python.org/ftp/python/2.7.15/Python-2.7.15.tgz
&&
tar
-xvf
Python-2.7.15.tgz
&&
cd
Python-2.7.15
./configure
--enable-unicode
=
ucs4
--enable-shared
CFLAGS
=
-fPIC
--prefix
=
/usr/local/
&&
make
&&
make
install
-j8
>
/dev/null
&&
make altinstall
>
/dev/null
&&
ldconfig
cd
..
&&
rm
-rf
Python-2.7.15
*
wget https://bootstrap.pypa.io/pip/2.7/get-pip.py
python2.7 get-pip.py
rm
-rf
get-pip.py
elif
[[
"
$VERSION
"
==
"3.6"
]]
;
then
wget
-q
https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tgz
&&
\
tar
-xzf
Python-3.6.8.tgz
&&
cd
Python-3.6.8
&&
\
CFLAGS
=
"-Wformat"
./configure
--prefix
=
/usr/local/
--enable-shared
>
/dev/null
&&
\
make
-j8
>
/dev/null
&&
make altinstall
>
/dev/null
&&
ldconfig
cd
..
&&
rm
-rf
Python-3.6.8
*
elif
[[
"
$VERSION
"
==
"3.7"
]]
;
then
wget
-q
https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz
&&
\
tar
-xzf
Python-3.7.0.tgz
&&
cd
Python-3.7.0
&&
\
CFLAGS
=
"-Wformat"
./configure
--prefix
=
/usr/local/
--enable-shared
>
/dev/null
&&
\
make
-j8
>
/dev/null
&&
make altinstall
>
/dev/null
&&
ldconfig
cd
..
&&
rm
-rf
Python-3.7.0
*
fi
tools/dockerfile/build_scripts/install_whl.sh
0 → 100644
浏览文件 @
37967fcb
#!/bin/bash
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
SERVING_VERSION
=
$1
PADDLE_VERSION
=
$2
RUN_ENV
=
$3
# cpu/10.1 10.2
PYTHON_VERSION
=
$4
client_release
=
"paddle-serving-client==
$SERVING_VERSION
"
app_release
=
"paddle-serving-app==0.3.1"
if
[[
"
$RUN_ENV
"
==
"cpu"
]]
;
then
server_release
=
"paddle-serving-server==
$SERVING_VERSION
"
python
$PYTHON_VERSION
-m
pip
install
$client_release
$app_release
$server_release
python
$PYTHON_VERSION
-m
pip
install
paddlepaddle
==
${
PADDLE_VERSION
}
cd
/usr/local/
wget https://paddle-serving.bj.bcebos.com/bin/serving-cpu-noavx-openblas-
${
SERVING_VERSION
}
.tar.gz
tar
xf serving-cpu-noavx-openblas-
${
SERVING_VERSION
}
.tar.gz
echo
"export SERVING_BIN=
$PWD
/serving-cpu-noavx-openblas-
${
SERVING_VERSION
}
/serving"
>>
/root/.bashrc
rm
-rf
serving-cpu-noavx-openblas-
${
SERVING_VERSION
}
.tar.gz
cd
-
elif
[[
"
$RUN_ENV
"
==
"cuda10.1"
]]
;
then
server_release
=
"paddle-serving-server-gpu==
$SERVING_VERSION
.post101"
python
$PYTHON_VERSION
-m
pip
install
$client_release
$app_release
$server_release
python
$PYTHON_VERSION
-m
pip
install
paddlepaddle-gpu
==
${
PADDLE_VERSION
}
cd
/usr/local/
wget https://paddle-serving.bj.bcebos.com/bin/serving-gpu-101-
${
SERVING_VERSION
}
.tar.gz
tar
xf serving-gpu-101-
${
SERVING_VERSION
}
.tar.gz
echo
"export SERVING_BIN=
$PWD
/serving-gpu-101-
${
SERVING_VERSION
}
/serving"
>>
/root/.bashrc
rm
-rf
serving-gpu-101-
${
SERVING_VERSION
}
.tar.gz
cd
-
elif
[[
"
$RUN_ENV
"
==
"cuda10.2"
]]
;
then
server_release
=
"paddle-serving-server-gpu==
$SERVING_VERSION
.post102"
python
$PYTHON_VERSION
-m
pip
install
$client_release
$app_release
$server_release
python
$PYTHON_VERSION
-m
pip
install
paddlepaddle-gpu
==
${
PADDLE_VERSION
}
cd
/usr/local/
wget https://paddle-serving.bj.bcebos.com/bin/serving-gpu-102-
${
SERVING_VERSION
}
.tar.gz
tar
xf serving-gpu-102-
${
SERVING_VERSION
}
.tar.gz
echo
"export SERVING_BIN=
$PWD
/serving-gpu-102-
${
SERVING_VERSION
}
/serving"
>>
/root/.bashrc
rm
-rf
serving-gpu-102-
${
SERVING_VERSION
}
.tar.gz
cd
-
fi
tools/generate_runtime_docker.sh
0 → 100644
浏览文件 @
37967fcb
#!/bin/sh
#abort on error
set
-e
function
usage
{
echo
"usage: arg_parse_example -a AN_ARG -s SOME_MORE_ARGS [-y YET_MORE_ARGS || -h]"
echo
" "
;
echo
" --env : running env, cpu/cuda10.1/cuda10.2/cuda11"
;
echo
" --python : python version, 2.7/3.6/3.7 "
;
echo
" --serving : serving version(0.5.0)"
;
echo
" --paddle : paddle version(2.0.1)"
echo
" --image_name : image name(default serving_runtime:env-python)"
echo
" -h | --help : helper"
;
}
function
parse_args
{
# positional args
args
=()
# named args
while
[
"
$1
"
!=
""
]
;
do
case
"
$1
"
in
--env
)
env
=
"
$2
"
;
shift
;;
--python
)
python
=
"
$2
"
;
shift
;;
--serving
)
serving
=
"
$2
"
;
shift
;;
--paddle
)
paddle
=
"
$2
"
;
shift
;;
--image_name
)
image_name
=
"
$2
"
;
shift
;;
-h
|
--help
)
usage
;
exit
;;
# quit and show usage
*
)
args+
=(
"
$1
"
)
# if no match, add it to the positional args
esac
shift
# move to next kv pair
done
# restore positional args
set
--
"
${
args
[@]
}
"
# set positionals to vars
positional_1
=
"
${
args
[0]
}
"
positional_2
=
"
${
args
[1]
}
"
# validate required args
if
[[
-z
"
${
paddle
}
"
||
-z
"
${
env
}
"
||
-z
"
${
python
}
"
||
-z
"
${
serving
}
"
]]
;
then
echo
"Invalid arguments"
usage
exit
;
fi
if
[[
-z
"
${
image_name
}
"
]]
;
then
image_name
=
"serving_runtime:
$env
-
$python
"
echo
"image_name is not assigned, so it will be set (
$image_name
)."
fi
}
function
run
{
parse_args
"
$@
"
echo
"named arg: env:
$env
"
if
[
$env
==
"cpu"
]
;
then
base_image
=
"ubuntu:16.04"
elif
[
$env
==
"cuda10.1"
]
;
then
base_image
=
"nvidia
\/
cuda:10.1-cudnn7-runtime-ubuntu16.04"
elif
[
$env
==
"cuda10.2"
]
;
then
base_image
=
"nvidia
\/
cuda:10.2-cudnn8-runtime-ubuntu16.04"
fi
echo
"base image:
$base_image
"
echo
"named arg: python:
$python
"
echo
"named arg: serving:
$serving
"
echo
"named arg: paddle:
$paddle
"
echo
"named arg: image_name:
$image_name
"
sed
-e
"s/<<base_image>>/
$base_image
/g"
-e
"s/<<python_version>>/
$python
/g"
-e
"s/<<run_env>>/
$env
/g"
Dockerfile.runtime_template
>
Dockerfile.tmp
docker build
--build-arg
ftp_proxy
=
http://172.19.57.45:3128
--build-arg
https_proxy
=
http://172.19.57.45:3128
--build-arg
http_proxy
=
http://172.19.57.45:3128
--build-arg
HTTP_PROXY
=
http://172.19.57.45:3128
--build-arg
HTTPS_PROXY
=
http://172.19.57.45:3128
-t
$image_name
-f
Dockerfile.tmp
.
}
run
"
$@
"
;
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录