Skip to content

Commit 06664fa

Browse files
author
yi.wu
committed
add docker build instructions
1 parent 9c7bed8 commit 06664fa

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

paddle/scripts/docker/README.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,18 +78,20 @@ The following commands check out the source code to the host and build the devel
7878
```bash
7979
git clone https://github.com/PaddlePaddle/Paddle paddle
8080
cd paddle
81-
docker build -t paddle:dev .
81+
docker build -t paddle:dev [--build-arg UBUNTU_MIRROR=mirror://mirrors.ubuntu.com/mirrors.txt] .
8282
```
8383

84-
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.
84+
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. Add `--build-arg UBUNTU_MIRROR=mirror://mirrors.ubuntu.com/mirrors.txt`
85+
if you want to use ubuntu mirrors to speed up the build.
8586

8687

8788
### Build PaddlePaddle from Source Code
8889

8990
Given the development image `paddle:dev`, the following command builds PaddlePaddle from the source tree on the development computer (host):
9091

9192
```bash
92-
docker run -v $PWD:/paddle -e "GPU=OFF" -e "AVX=ON" -e "TEST=ON" paddle:dev
93+
docker run -v $PWD:/paddle -e "WITH_GPU=OFF" -e "WITH_AVX=ON" \
94+
-e "TEST=ON" -e "BUILD_AND_INSTALL=ON" [-e "DELETE_BUILD_CACHE=ON"] paddle:dev
9395
```
9496

9597
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,16 +102,23 @@ This command mounts the source directory on the host into `/paddle` in the conta
100102
- `$PWD/build/paddle-<version>.deb` for production installation, and
101103
- `$PWD/build/Dockerfile`, which builds the production Docker image.
102104

105+
Environment varibles(use `ON` and `OFF` to put the switch on and off):
106+
- `WITH_GPU`: build paddle with gpu driver and libraries.
107+
- `WITH_AVX`: only lagacy hardwares without avx or sse or other [SIMD](https://en.wikipedia.org/wiki/SIMD) need to put it to "OFF"
108+
- `TEST`: test after build
109+
- `BUILD_AND_INSTALL`: put this to "OFF" if you don't really want to build, used to generate production Dockerfiles.
110+
- `DELETE_BUILD_CACHE`: put this to "ON" when build paddle for multiple times, third_party will not download and build again.
103111

104112
### Build the Production Docker Image
105113

106114
The following command builds the production image:
107115

108116
```bash
109-
docker build -t paddle -f build/Dockerfile .
117+
docker build -t paddle -f build/Dockerfile[.cpu|.gpu|.noavx|.gpu-noavx] .
110118
```
111119

112-
This production image is minimal -- it includes binary `paddle`, the shared library `libpaddle.so`, and Python runtime.
120+
There are 4 different branch of the production image: cpu, gpu, noavx and gpu-noavx.
121+
These images are made to minimal size -- they includes binary `paddle`, the shared library `libpaddle.so`, and Python runtime.
113122

114123
### Run PaddlePaddle Applications
115124

0 commit comments

Comments
 (0)