Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleDetection
提交
7485e5d7
P
PaddleDetection
项目概览
s920243400
/
PaddleDetection
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleDetection
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
7485e5d7
编写于
3月 20, 2017
作者:
H
Helin Wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refine docker build
上级
a71218c9
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
96 addition
and
114 deletion
+96
-114
.dockerignore
.dockerignore
+15
-1
.dockerignore
.dockerignore
+15
-1
Dockerfile
Dockerfile
+1
-6
paddle/scripts/docker/build.sh
paddle/scripts/docker/build.sh
+65
-106
未找到文件。
.dockerignore
已删除
120000 → 0
浏览文件 @
a71218c9
.gitignore
\ No newline at end of file
.dockerignore
0 → 100644
浏览文件 @
7485e5d7
*.DS_Store
build/
*.user
.vscode
.idea
.project
.cproject
.pydevproject
Makefile
.test_env/
third_party/
*~
bazel-*
!build/*.deb
Dockerfile
浏览文件 @
7485e5d7
...
@@ -3,20 +3,17 @@
...
@@ -3,20 +3,17 @@
FROM
nvidia/cuda:7.5-cudnn5-devel-ubuntu14.04
FROM
nvidia/cuda:7.5-cudnn5-devel-ubuntu14.04
MAINTAINER
PaddlePaddle Authors <paddle-dev@baidu.com>
MAINTAINER
PaddlePaddle Authors <paddle-dev@baidu.com>
ARG
DEBIAN_FRONTEND=noninteractive
ARG
UBUNTU_MIRROR
ARG
UBUNTU_MIRROR
RUN
/bin/bash
-c
'if [[ -n ${UBUNTU_MIRROR} ]]; then sed -i '
s#http://archive.ubuntu.com/ubuntu#
${
UBUNTU_MIRROR
}
#g' /etc/apt/sources.list; fi'
RUN
/bin/bash
-c
'if [[ -n ${UBUNTU_MIRROR} ]]; then sed -i '
s#http://archive.ubuntu.com/ubuntu#
${
UBUNTU_MIRROR
}
#g' /etc/apt/sources.list; fi'
# ENV variables
# ENV variables
ARG
BUILD_WOBOQ
ARG
BUILD_WOBOQ
ARG
BUILD_AND_INSTALL
ARG
WITH_GPU
ARG
WITH_GPU
ARG
WITH_AVX
ARG
WITH_AVX
ARG
WITH_DOC
ARG
WITH_DOC
ARG
WITH_STYLE_CHECK
ARG
WITH_STYLE_CHECK
ENV
BUILD_WOBOQ=${BUILD_WOBOQ:-OFF}
ENV
BUILD_WOBOQ=${BUILD_WOBOQ:-OFF}
ENV
BUILD_AND_INSTALL=${BUILD_AND_INSTALL:-OFF}
ENV
WITH_GPU=${WITH_AVX:-OFF}
ENV
WITH_GPU=${WITH_AVX:-OFF}
ENV
WITH_AVX=${WITH_AVX:-ON}
ENV
WITH_AVX=${WITH_AVX:-ON}
ENV
WITH_DOC=${WITH_DOC:-OFF}
ENV
WITH_DOC=${WITH_DOC:-OFF}
...
@@ -31,7 +28,7 @@ RUN apt-get update && \
...
@@ -31,7 +28,7 @@ RUN apt-get update && \
apt-get
install
-y
wget unzip
tar
xz-utils bzip2
gzip
coreutils
&&
\
apt-get
install
-y
wget unzip
tar
xz-utils bzip2
gzip
coreutils
&&
\
apt-get
install
-y
curl
sed grep
graphviz libjpeg-dev zlib1g-dev
&&
\
apt-get
install
-y
curl
sed grep
graphviz libjpeg-dev zlib1g-dev
&&
\
apt-get
install
-y
python-numpy python-matplotlib gcc g++ gfortran
&&
\
apt-get
install
-y
python-numpy python-matplotlib gcc g++ gfortran
&&
\
apt-get
install
-y
automake locales clang-format-3.8
&&
\
apt-get
install
-y
automake locales clang-format-3.8
swig
&&
\
apt-get clean
-y
apt-get clean
-y
# git credential to skip password typing
# git credential to skip password typing
...
@@ -51,8 +48,6 @@ RUN curl -sSL https://cmake.org/files/v3.4/cmake-3.4.1.tar.gz | tar -xz && \
...
@@ -51,8 +48,6 @@ RUN curl -sSL https://cmake.org/files/v3.4/cmake-3.4.1.tar.gz | tar -xz && \
cd
cmake-3.4.1
&&
./bootstrap
&&
make
-j
`
nproc
`
&&
make
install
&&
\
cd
cmake-3.4.1
&&
./bootstrap
&&
make
-j
`
nproc
`
&&
make
install
&&
\
cd
..
&&
rm
-rf
cmake-3.4.1
cd
..
&&
rm
-rf
cmake-3.4.1
RUN
apt-get
install
-y
swig
VOLUME
["/usr/share/nginx/html/data", "/usr/share/nginx/html/paddle"]
VOLUME
["/usr/share/nginx/html/data", "/usr/share/nginx/html/paddle"]
# Configure OpenSSH server. c.f. https://docs.docker.com/engine/examples/running_ssh_service
# Configure OpenSSH server. c.f. https://docs.docker.com/engine/examples/running_ssh_service
...
...
paddle/scripts/docker/build.sh
浏览文件 @
7485e5d7
#!/bin/bash
#!/bin/bash
function
abort
(){
echo
"An error occurred. Exiting..."
1>&2
exit
1
}
trap
'abort'
0
set
-e
set
-e
mkdir
-p
/paddle/dist/cpu
mkdir
-p
/paddle/dist/gpu
# Set BASE_IMAGE according to env variables
mkdir
-p
/paddle/dist/cpu-noavx
mkdir
-p
/paddle/dist/gpu-noavx
# Set BASE_IMAGE and DEB_PATH according to env variables
if
[
${
WITH_GPU
}
==
"ON"
]
;
then
if
[
${
WITH_GPU
}
==
"ON"
]
;
then
BASE_IMAGE
=
"nvidia/cuda:7.5-cudnn5-runtime-ubuntu14.04"
BASE_IMAGE
=
"nvidia/cuda:7.5-cudnn5-runtime-ubuntu14.04"
# additional packages to install when building gpu images
# additional packages to install when building gpu images
GPU_DOCKER_PKG
=
"python-pip"
GPU_DOCKER_PKG
=
"python-pip python-dev"
if
[
${
WITH_AVX
}
==
"ON"
]
;
then
DEB_PATH
=
"dist/gpu/"
DOCKER_SUFFIX
=
"gpu"
else
DEB_PATH
=
"dist/gpu-noavx/"
DOCKER_SUFFIX
=
"gpu-noavx"
fi
else
else
BASE_IMAGE
=
"python:2.7.13-slim"
BASE_IMAGE
=
"python:2.7.13-slim"
if
[
${
WITH_AVX
}
==
"ON"
]
;
then
DEB_PATH
=
"dist/cpu/"
DOCKER_SUFFIX
=
"cpu"
else
DEB_PATH
=
"dist/cpu-noavx/"
DOCKER_SUFFIX
=
"noavx"
fi
fi
fi
# If Dockerfile.* sets BUILD_AND_INSTALL to 'ON', it would have copied
# source tree to /paddle, and this scripts should build it into
DOCKERFILE_GPU_ENV
=
""
# /paddle/build.
if
[[
${
WITH_GPU
:-
OFF
}
==
'ON'
]]
;
then
if
[[
${
BUILD_AND_INSTALL
:-
OFF
}
==
'ON'
]]
;
then
DOCKERFILE_GPU_ENV
=
"ENV LD_LIBRARY_PATH /usr/lib/x86_64-linux-gnu:
${
LD_LIBRARY_PATH
}
"
if
[[
${
WITH_GPU
:-
OFF
}
==
'ON'
]]
;
then
fi
ln
-s
/usr/lib/x86_64-linux-gnu/libcudnn.so /usr/lib/libcudnn.so
fi
mkdir
-p
/paddle/build
cd
/paddle/build
mkdir
-p
/paddle/build
# -p means no error if exists
cd
/paddle/build
# build script will not fail if *.deb does not exist
# clean local cmake and third_party cache
rm
*
.deb
||
true
if
[
${
DELETE_BUILD_CACHE
}
==
'ON'
]
;
then
rm
-rf
*
&&
rm
-rf
../third_party
cmake ..
\
fi
cmake ..
\
-DCMAKE_BUILD_TYPE
=
Release
\
-DCMAKE_BUILD_TYPE
=
Release
\
-DWITH_DOC
=
${
WITH_DOC
:-
OFF
}
\
-DWITH_DOC
=
${
WITH_DOC
:-
OFF
}
\
-DWITH_GPU
=
${
WITH_GPU
:-
OFF
}
\
-DWITH_GPU
=
${
WITH_GPU
:-
OFF
}
\
-DWITH_AVX
=
${
WITH_AVX
:-
OFF
}
\
-DWITH_AVX
=
${
WITH_AVX
:-
OFF
}
\
-DWITH_SWIG_PY
=
ON
\
-DWITH_SWIG_PY
=
ON
\
-DCUDNN_ROOT
=
/usr/
\
-DCUDNN_ROOT
=
/usr/
\
-DWITH_STYLE_CHECK
=
OFF
\
-DWITH_STYLE_CHECK
=
${
WITH_STYLE_CHECK
:-
OFF
}
\
-DON_COVERALLS
=
${
TEST
:-
OFF
}
\
-DCMAKE_EXPORT_COMPILE_COMMANDS
=
ON
-DCMAKE_EXPORT_COMPILE_COMMANDS
=
ON
make
-j
`
nproc
`
make
-j
`
nproc
`
make
install
if
[[
${
TEST
:-
OFF
}
==
"ON"
]]
;
then
# generate deb package for current build
make coveralls
# FIXME(typhoonzero): should we remove paddle/scripts/deb ?
fi
# FIXME: CPACK_DEBIAN_PACKAGE_DEPENDS removes all dev dependencies, must
make
install
# install them in docker
cpack
-D
CPACK_GENERATOR
=
'DEB'
-D
CPACK_DEBIAN_PACKAGE_DEPENDS
=
""
..
# generate deb package for current build
mv
/paddle/build/
*
.deb /paddle/
${
DEB_PATH
}
# FIXME(typhoonzero): should we remove paddle/scripts/deb ?
# FIXME: CPACK_DEBIAN_PACKAGE_DEPENDS removes all dev dependencies, must
if
[[
${
BUILD_WOBOQ
:-
OFF
}
==
'ON'
]]
;
then
# install them in docker
cpack
-D
CPACK_GENERATOR
=
'DEB'
-D
CPACK_DEBIAN_PACKAGE_DEPENDS
=
""
..
if
[[
${
BUILD_WOBOQ
:-
OFF
}
==
'ON'
]]
;
then
apt-get
install
-y
clang-3.8 llvm-3.8 libclang-3.8-dev
apt-get
install
-y
clang-3.8 llvm-3.8 libclang-3.8-dev
# Install woboq_codebrowser.
# Install woboq_codebrowser.
git clone https://github.com/woboq/woboq_codebrowser /woboq
git clone https://github.com/woboq/woboq_codebrowser /woboq
...
@@ -87,19 +66,10 @@ if [[ ${BUILD_AND_INSTALL:-OFF} == 'ON' ]]; then
...
@@ -87,19 +66,10 @@ if [[ ${BUILD_AND_INSTALL:-OFF} == 'ON' ]]; then
/woboq/indexgenerator/codebrowser_indexgenerator
$WOBOQ_OUT
/woboq/indexgenerator/codebrowser_indexgenerator
$WOBOQ_OUT
cd
/woboq
cd
/woboq
make clean
make clean
fi
pip
install
/usr/local/opt/paddle/share/wheels/py_paddle
*
linux
*
.whl
pip
install
/usr/local/opt/paddle/share/wheels/paddle
*
.whl
paddle version
if
[[
${
DOCKER_BUILD
:-
FALSE
}
==
'TRUE'
]]
;
then
# reduce docker image size
rm
-rf
/paddle/build
rm
-rf
/usr/local/opt/paddle/share/wheels/
fi
fi
fi
paddle version
# generate production docker image Dockerfile
# generate production docker image Dockerfile
if
[
${
USE_MIRROR
}
]
;
then
if
[
${
USE_MIRROR
}
]
;
then
MIRROR_UPDATE
=
"sed 's@http:
\/\/
archive.ubuntu.com
\/
ubuntu
\/
@mirror:
\/\/
mirrors.ubuntu.com
\/
mirrors.txt@' -i /etc/apt/sources.list &&
\\
"
MIRROR_UPDATE
=
"sed 's@http:
\/\/
archive.ubuntu.com
\/
ubuntu
\/
@mirror:
\/\/
mirrors.ubuntu.com
\/
mirrors.txt@' -i /etc/apt/sources.list &&
\\
"
...
@@ -107,20 +77,10 @@ else
...
@@ -107,20 +77,10 @@ else
MIRROR_UPDATE
=
"
\\
"
MIRROR_UPDATE
=
"
\\
"
fi
fi
cat
>
/paddle/build/Dockerfile
.
${
DOCKER_SUFFIX
}
<<
EOF
cat
>
/paddle/build/Dockerfile
<<
EOF
FROM
${
BASE_IMAGE
}
FROM
${
BASE_IMAGE
}
MAINTAINER PaddlePaddle Authors <paddle-dev@baidu.com>
MAINTAINER PaddlePaddle Authors <paddle-dev@baidu.com>
# ENV variables
ARG WITH_AVX
ARG WITH_DOC
ARG WITH_STYLE_CHECK
ENV WITH_GPU=
${
WITH_GPU
}
ENV WITH_AVX=
\$
{WITH_AVX:-ON}
ENV WITH_DOC=
\$
{WITH_DOC:-OFF}
ENV WITH_STYLE_CHECK=
\$
{WITH_STYLE_CHECK:-OFF}
ENV HOME /root
ENV HOME /root
ENV LANG en_US.UTF-8
ENV LANG en_US.UTF-8
...
@@ -128,18 +88,17 @@ ENV LANG en_US.UTF-8
...
@@ -128,18 +88,17 @@ ENV LANG en_US.UTF-8
RUN
${
MIRROR_UPDATE
}
RUN
${
MIRROR_UPDATE
}
apt-get update &&
\
apt-get update &&
\
apt-get install -y libgfortran3
${
GPU_DOCKER_PKG
}
&&
\
apt-get install -y libgfortran3
libpython2.7
${
GPU_DOCKER_PKG
}
&&
\
apt-get clean -y &&
\
apt-get clean -y &&
\
pip install --upgrade pip &&
\
pip install --upgrade pip &&
\
pip install -U 'protobuf==3.1.0' requests
pip install -U 'protobuf==3.1.0' requests numpy
RUN pip install numpy
# Use different deb file when building different type of images
# Use different deb file when building different type of images
ADD
\$
PWD/
${
DEB_PATH
}
*.deb /usr/local/opt/paddle/deb/
ADD build/*.deb /usr/local/opt/paddle/deb/
RUN dpkg --force-all -i /usr/local/opt/paddle/deb/*.deb && rm -f /usr/local/opt/paddle/deb/*.deb
ENV PATH="/usr/local/opt/paddle/bin/:
${
PATH
}
"
# run paddle version to install python packages first
RUN dpkg -i /usr/local/opt/paddle/deb/*.deb && rm -f /usr/local/opt/paddle/deb/*.deb && paddle version
${
DOCKERFILE_GPU_ENV
}
# default command shows the paddle version and exit
# default command shows the paddle version and exit
CMD ["paddle", "version"]
CMD ["paddle", "version"]
EOF
EOF
trap
: 0
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录