diff --git a/paddle/scripts/docker/README.md b/paddle/scripts/docker/README.md index 8c35411fc390ef218e395c58808d644e7a35095e..e5af5c9a1e6f96c5112895a1ec0b0c6ac57da666 100644 --- a/paddle/scripts/docker/README.md +++ b/paddle/scripts/docker/README.md @@ -83,13 +83,18 @@ docker build -t paddle:dev . The `docker build` command assumes that `Dockerfile` is in the root source tree. Note that in this design, this `Dockerfile` is this only one in our repo. +Users can specify a Ubuntu mirror server for faster downloading: + +```bash +docker build -t paddle:dev --build-arg UBUNTU_MIRROR=mirror://mirrors.ubuntu.com/mirrors.txt . +``` ### Build PaddlePaddle from Source Code Given the development image `paddle:dev`, the following command builds PaddlePaddle from the source tree on the development computer (host): ```bash -docker run -v $PWD:/paddle -e "GPU=OFF" -e "AVX=ON" -e "TEST=ON" paddle:dev +docker run -v $PWD:/paddle -e "WITH_GPU=OFF" -e "WITH_AVX=ON" -e "TEST=OFF" paddle:dev ``` This command mounts the source directory on the host into `/paddle` in the container, so the default entry point of `paddle:dev`, `build.sh`, could build the source code with possible local changes. When it writes to `/paddle/build` in the container, it writes to `$PWD/build` on the host indeed. @@ -100,6 +105,10 @@ This command mounts the source directory on the host into `/paddle` in the conta - `$PWD/build/paddle-.deb` for production installation, and - `$PWD/build/Dockerfile`, which builds the production Docker image. +Users can specify the following Docker build arguments with either "ON" or "OFF" value: +- `WITH_GPU`: ***Required***. Generates NVIDIA CUDA GPU code and relies on CUDA libraries. +- `WITH_AVX`: ***Required***. Set to "OFF" prevents from generating AVX instructions. If you don't know what is AVX, you might want to set "ON". +- `TEST`: ***Optional, default OFF***. Build unit tests and run them after building. ### Build the Production Docker Image diff --git a/paddle/scripts/docker/build.sh b/paddle/scripts/docker/build.sh old mode 100755 new mode 100644 index 285ebdb9c36505ec634ed38fe36f74ca12168e14..5ebdf6fa405e8e765371dff37c75302d9352b1e1 --- a/paddle/scripts/docker/build.sh +++ b/paddle/scripts/docker/build.sh @@ -80,12 +80,9 @@ fi cat > /paddle/build/Dockerfile < - ENV HOME /root ENV LANG en_US.UTF-8 - # Use Fix locales to en_US.UTF-8 - RUN ${MIRROR_UPDATE} apt-get update && \ apt-get install -y libgfortran3 libpython2.7 ${GPU_DOCKER_PKG} && \ @@ -94,10 +91,8 @@ RUN ${MIRROR_UPDATE} pip install -U 'protobuf==3.1.0' requests numpy # Use different deb file when building different type of images ADD build/*.deb /usr/local/opt/paddle/deb/ - # 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 CMD ["paddle", "version"]