diff --git a/.tools/build_docker.sh b/.tools/build_docker.sh new file mode 100755 index 0000000000000000000000000000000000000000..55faa715a4fbbda97d8ff6422fb2e3d7fe8668fc --- /dev/null +++ b/.tools/build_docker.sh @@ -0,0 +1,40 @@ +#!/bin/bash +cur_path="$(cd "$(dirname "$0")" && pwd -P)" +cd $cur_path/../ + +#convert md to ipynb +.tools/convert-markdown-into-ipynb-and-test.sh + +paddle_version=0.10.0rc2 + +#generate docker file +if [ ${USE_UBUNTU_REPO_MIRROR} ]; then + UPDATE_MIRROR_CMD="sed 's@http:\/\/archive.ubuntu.com\/ubuntu\/@mirror:\/\/mirrors.ubuntu.com\/mirrors.txt@' -i /etc/apt/sources.list && \\" +else + UPDATE_MIRROR_CMD="\\" +fi + +mkdir -p build +cat > build/Dockerfile < + +RUN ${UPDATE_MIRROR_CMD} + apt-get install locales +RUN localedef -f UTF-8 -i en_US en_US.UTF-8 + +RUN apt-get -y install gcc && \ + apt-get -y clean + +RUN pip install -U matplotlib jupyter numpy requests scipy + +COPY . /book +RUN rm -rf /book/build + +EXPOSE 8888 +CMD ["sh", "-c", "jupyter notebook --ip=0.0.0.0 --no-browser --NotebookApp.token='' --NotebookApp.disable_check_xsrf=True /book/"] +EOF + +#build docker image +echo "paddle_version:"$paddle_version +docker build --no-cache -t paddlepaddle/book:${paddle_version} -t paddlepaddle/book:latest -f ./build/Dockerfile . diff --git a/.tools/convert-markdown-into-ipynb-and-test.sh b/.tools/convert-markdown-into-ipynb-and-test.sh index ef47387dc46d96e096095189c96122be5c370741..710b61957a82c033531d267aaccafcc616e6e46d 100755 --- a/.tools/convert-markdown-into-ipynb-and-test.sh +++ b/.tools/convert-markdown-into-ipynb-and-test.sh @@ -5,9 +5,9 @@ if [ $? -ne 0 ]; then exit 1 fi -GOPATH=/tmp/go go get -u github.com/wangkuiyi/ipynb/markdown-to-ipynb +GOPATH=~/.go go get -u github.com/wangkuiyi/ipynb/markdown-to-ipynb -cur_path=$(dirname $(readlink -f $0)) +cur_path="$(cd "$(dirname "$0")" && pwd -P)" cd $cur_path/../ #convert md to ipynb