Skip to content

Commit 756ee92

Browse files
authored
Merge pull request #1869 from reyoung/curl_is_also_need_by_paddle
Refactor the ways to build docker image
2 parents dba0672 + 9b45b26 commit 756ee92

File tree

4 files changed

+30
-29
lines changed

4 files changed

+30
-29
lines changed

cmake/package.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
set(CPACK_PACKAGE_NAME paddle)
2-
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "")
32
set(CPACK_PACKAGE_VERSION_MAJOR ${PADDLE_MAJOR_VERSION})
43
set(CPACK_PACKAGE_VERSION_MINOR ${PADDLE_MINOR_VERSION})
54
set(CPACK_PACKAGE_VERSION_PATCH ${PADDLE_PATCH_VERSION})
@@ -10,8 +9,9 @@ set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE amd64)
109
set(CPACK_DEBIAN_PACKAGE_MAINTAINER PaddlePaddle Dev <[email protected]>)
1110
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Paddle")
1211
set(CPACK_PACKAGE_DESCRIPTION "")
13-
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libatlas3-base, libgflags2, libgoogle-glog0, libprotobuf8, libpython2.7, libstdc++6, python-numpy, python-pip, python-pip-whl, python-protobuf")
12+
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libpython2.7-dev, libstdc++6, python-pip, curl, libgfortran3, python-pip-whl")
1413
set(CPACK_DEBIAN_PACKAGE_SECTION Devel)
14+
set(CPACK_DEBIAN_PACKAGE_VERSION ${PADDLE_VERSION})
1515
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${PROJ_ROOT}/paddle/scripts/deb/postinst")
1616
#set(CPACK_GENERATOR "DEB")
1717
# Start cpack

paddle/scripts/deb/postinst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
set -e
3+
echo "Post install paddle debian package."
4+
echo "Install some python package used for paddle. You can run "
5+
echo " pip install /usr/opt/paddle/share/wheels/*.whl to install them."
6+
find /usr/ -name '*paddle*.whl' | xargs pip install

paddle/scripts/docker/build.sh

Lines changed: 17 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,8 @@ set -e
55
# Set BASE_IMAGE according to env variables
66
if [ ${WITH_GPU} == "ON" ]; then
77
BASE_IMAGE="nvidia/cuda:8.0-cudnn5-runtime-ubuntu14.04"
8-
# additional packages to install when building gpu images
9-
GPU_DOCKER_PKG="python-pip python-dev"
108
else
11-
BASE_IMAGE="python:2.7.13-slim"
12-
# FIXME: python base image uses different python version than WITH_GPU
13-
# need to change PYTHONHOME to /usr/local when using python base image
14-
CPU_DOCKER_PYTHON_HOME_ENV="ENV PYTHONHOME /usr/local"
9+
BASE_IMAGE="ubuntu:14.04"
1510
fi
1611

1712
DOCKERFILE_GPU_ENV=""
@@ -60,10 +55,7 @@ if [ ${WITH_DOC} == "ON" ]; then
6055
popd
6156
fi
6257
# generate deb package for current build
63-
# FIXME(typhoonzero): should we remove paddle/scripts/deb ?
64-
# FIXME: CPACK_DEBIAN_PACKAGE_DEPENDS removes all dev dependencies, must
65-
# install them in docker
66-
cpack -D CPACK_GENERATOR='DEB' -D CPACK_DEBIAN_PACKAGE_DEPENDS="" ..
58+
cpack -D CPACK_GENERATOR='DEB' ..
6759

6860
if [[ ${WOBOQ:-OFF} == 'ON' ]]; then
6961
apt-get install -y clang-3.8 llvm-3.8 libclang-3.8-dev
@@ -91,32 +83,30 @@ fi
9183

9284
paddle version
9385

94-
if [[ -n ${APT_MIRROR} ]]; then
95-
MIRROR_UPDATE="sed -i '${APT_MIRROR}' /etc/apt/sources.list && \\"
96-
else
97-
MIRROR_UPDATE="\\"
98-
fi
99-
10086
cat > /paddle/build/Dockerfile <<EOF
10187
FROM ${BASE_IMAGE}
10288
MAINTAINER PaddlePaddle Authors <[email protected]>
10389
ENV HOME /root
10490
ENV LANG en_US.UTF-8
10591
# Use Fix locales to en_US.UTF-8
106-
RUN ${MIRROR_UPDATE}
107-
apt-get update && \
108-
apt-get install -y libgfortran3 libpython2.7 ${GPU_DOCKER_PKG} && \
109-
apt-get clean -y && \
110-
pip install --upgrade pip && \
111-
pip install -U 'protobuf==3.1.0' requests numpy
92+
EOF
93+
94+
if [[ -n ${APT_MIRROR} ]]; then
95+
cat >> /paddle/build/Dockerfile <<EOF
96+
RUN sed -i '${APT_MIRROR}' /etc/apt/sources.list
97+
EOF
98+
fi
99+
100+
cat >> /paddle/build/Dockerfile <<EOF
112101
# Use different deb file when building different type of images
113-
ADD build/*.deb /usr/local/opt/paddle/deb/
102+
ADD build/*.deb /
114103
# run paddle version to install python packages first
115-
RUN dpkg -i /usr/local/opt/paddle/deb/*.deb && \
116-
rm -f /usr/local/opt/paddle/deb/*.deb && \
117-
find /usr/ -name '*paddle-*.whl' | xargs pip install && \
104+
RUN apt-get update &&\
105+
apt-get install -y python-pip && pip install -U pip && \
106+
dpkg -i /*.deb ; apt-get install -f -y && \
107+
apt-get clean -y && \
108+
rm -f /*.deb && \
118109
paddle version
119-
${CPU_DOCKER_PYTHON_HOME_ENV}
120110
${DOCKERFILE_CUDNN_DSO}
121111
${DOCKERFILE_GPU_ENV}
122112
# default command shows the paddle version and exit

python/setup.py.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ setup(name='paddle',
1414
version='${PADDLE_VERSION}',
1515
description='Parallel Distributed Deep Learning',
1616
packages=packages,
17+
install_requires=[
18+
"numpy",
19+
"protobuf==3.1.0",
20+
"matplotlib",
21+
],
1722
package_dir={
1823
'': '${CMAKE_CURRENT_SOURCE_DIR}'
1924
}

0 commit comments

Comments
 (0)