Skip to content

Commit caffcc8

Browse files
authored
Merge pull request #1707 from Yancey1989/woboq_view
reading source code with woboq
2 parents 3133c09 + a073575 commit caffcc8

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

Dockerfile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@ ARG UBUNTU_MIRROR
77
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'
88

99
# ENV variables
10-
ARG BUILD_WOBOQ
1110
ARG WITH_GPU
1211
ARG WITH_AVX
1312
ARG WITH_DOC
1413
ARG WITH_STYLE_CHECK
1514

16-
ENV BUILD_WOBOQ=${BUILD_WOBOQ:-OFF}
15+
ENV WOBOQ OFF
1716
ENV WITH_GPU=${WITH_AVX:-OFF}
1817
ENV WITH_AVX=${WITH_AVX:-ON}
1918
ENV WITH_DOC=${WITH_DOC:-OFF}
@@ -48,7 +47,7 @@ RUN curl -sSL https://cmake.org/files/v3.4/cmake-3.4.1.tar.gz | tar -xz && \
4847
cd cmake-3.4.1 && ./bootstrap && make -j `nproc` && make install && \
4948
cd .. && rm -rf cmake-3.4.1
5049

51-
VOLUME ["/usr/share/nginx/html/data", "/usr/share/nginx/html/paddle"]
50+
VOLUME ["/woboq_out"]
5251

5352
# Configure OpenSSH server. c.f. https://docs.docker.com/engine/examples/running_ssh_service
5453
RUN mkdir /var/run/sshd

paddle/scripts/docker/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,3 +166,18 @@ docker tag myapp me/myapp
166166
docker push
167167
kubectl ...
168168
```
169+
170+
### Reading source code with woboq codebrowser
171+
For developers who are interested in the C++ source code, please use -e "WOBOQ=ON" to enable the building of C++ source code into HTML pages using [Woboq codebrowser](https://github.com/woboq/woboq_codebrowser).
172+
173+
- The following command builds PaddlePaddle, generates HTML pages from C++ source code, and writes HTML pages into `$HOME/woboq_out` on the host:
174+
175+
```bash
176+
docker run -v $PWD:/paddle -v $HOME/woboq_out:/woboq_out -e "WITH_GPU=OFF" -e "WITH_AVX=ON" -e "WITH_TEST=ON" -e "WOBOQ=ON" paddle:dev
177+
```
178+
179+
- You can open the generated HTML files in your Web browser. Or, if you want to run a Nginx container to serve them for a wider audience, you can run:
180+
181+
```
182+
docker run -v $HOME/woboq_out:/usr/share/nginx/html -d -p 8080:80 nginx
183+
```

paddle/scripts/docker/build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ make install
4646
# install them in docker
4747
cpack -D CPACK_GENERATOR='DEB' -D CPACK_DEBIAN_PACKAGE_DEPENDS="" ..
4848

49-
if [[ ${BUILD_WOBOQ:-OFF} == 'ON' ]]; then
49+
if [[ ${WOBOQ:-OFF} == 'ON' ]]; then
5050
apt-get install -y clang-3.8 llvm-3.8 libclang-3.8-dev
5151
# Install woboq_codebrowser.
5252
git clone https://github.com/woboq/woboq_codebrowser /woboq
@@ -56,7 +56,7 @@ if [[ ${BUILD_WOBOQ:-OFF} == 'ON' ]]; then
5656
.
5757
make
5858

59-
export WOBOQ_OUT=/usr/share/nginx/html/paddle
59+
export WOBOQ_OUT=/woboq_out/paddle
6060
export BUILD_DIR=/paddle/build
6161
mkdir -p $WOBOQ_OUT
6262
cp -rv /woboq/data $WOBOQ_OUT/../data

0 commit comments

Comments
 (0)