Skip to content

Commit f192800

Browse files
author
reyoung
committed
Refine Docker build
1 parent b3c6cd0 commit f192800

File tree

4 files changed

+12
-27
lines changed

4 files changed

+12
-27
lines changed

cmake/package.cmake

Lines changed: 1 addition & 1 deletion
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})
@@ -12,6 +11,7 @@ set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Paddle")
1211
set(CPACK_PACKAGE_DESCRIPTION "")
1312
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libpython2.7, 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: 3 additions & 25 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=""
@@ -88,12 +83,6 @@ fi
8883

8984
paddle version
9085

91-
if [[ -n ${APT_MIRROR} ]]; then
92-
MIRROR_UPDATE="sed -i '${APT_MIRROR}' /etc/apt/sources.list"
93-
else
94-
MIRROR_UPDATE=""
95-
fi
96-
9786
cat > /paddle/build/Dockerfile <<EOF
9887
FROM ${BASE_IMAGE}
9988
MAINTAINER PaddlePaddle Authors <[email protected]>
@@ -102,23 +91,13 @@ ENV LANG en_US.UTF-8
10291
# Use Fix locales to en_US.UTF-8
10392
EOF
10493

105-
if [[ -n ${MIRROR_UPDATE} ]]; then
106-
cat >> /paddle/build/Dockerfile <<EOF
107-
RUN ${MIRROR_UPDATE}
108-
EOF
109-
fi
110-
111-
if [[ -n ${GPU_DOCKER_PKG} ]]; then
94+
if [[ -n ${APT_MIRROR} ]]; then
11295
cat >> /paddle/build/Dockerfile <<EOF
113-
RUN apt-get update && \
114-
apt-get install -y ${GPU_DOCKER_PKG} && \
115-
apt-get clean -y
96+
RUN sed -i '${APT_MIRROR}' /etc/apt/sources.list
11697
EOF
11798
fi
11899

119100
cat >> /paddle/build/Dockerfile <<EOF
120-
RUN pip install --upgrade pip
121-
122101
# Use different deb file when building different type of images
123102
ADD build/*.deb /
124103
# run paddle version to install python packages first
@@ -127,7 +106,6 @@ RUN apt-get update &&\
127106
apt-get clean -y && \
128107
rm -f /*.deb && \
129108
paddle version
130-
${CPU_DOCKER_PYTHON_HOME_ENV}
131109
${DOCKERFILE_CUDNN_DSO}
132110
${DOCKERFILE_GPU_ENV}
133111
# default command shows the paddle version and exit

python/setup.py.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ setup(name='paddle',
1616
packages=packages,
1717
install_requires=[
1818
"numpy",
19-
"protobuf==3.1.0"
19+
"protobuf==3.1.0",
20+
"matplotlib",
2021
],
2122
package_dir={
2223
'': '${CMAKE_CURRENT_SOURCE_DIR}'

0 commit comments

Comments
 (0)