提交 e7d2ad90 编写于 作者: G gongweibao

copy cache data

上级 dcd4070a
......@@ -2,24 +2,32 @@
cur_path="$(cd "$(dirname "$0")" && pwd -P)"
cd $cur_path/../
#check cache data
cache_data_path=.cache/paddle/dataset
if [ ${COPY_CACHE_DATA} ] && [ ! -d $cache_data_path ]; then
echo 2>&1 "Check the cache_data_path:${cache_data_path}"
exit 1
fi
#convert md to ipynb
.tools/convert-markdown-into-ipynb-and-test.sh
paddle_version=0.10.0rc2
latest_label=latest
#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 && \\"
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="\\"
update_mirror_cmd="\\"
fi
mkdir -p build
cat > build/Dockerfile <<EOF
cat > build/Dockerfile <<EOF1
FROM paddlepaddle/paddle:${paddle_version}
MAINTAINER PaddlePaddle Authors <paddle-dev@baidu.com>
RUN ${UPDATE_MIRROR_CMD}
RUN ${update_mirror_cmd}
apt-get install locales
RUN localedef -f UTF-8 -i en_US en_US.UTF-8
......@@ -30,6 +38,18 @@ RUN pip install -U matplotlib jupyter numpy requests scipy
COPY . /book
RUN rm -rf /book/build
EOF1
if [ ${COPY_CACHE_DATA} ]; then
cat >> build/Dockerfile << EOF2
RUN mkdir -p /root/${cache_data_path}
RUN mv /book/${cache_data_path}/* /root/${cache_data_path}/ && rm -rf /book/${cache_data_path}
EOF2
fi
cat >> build/Dockerfile << EOF
EXPOSE 8888
CMD ["sh", "-c", "jupyter notebook --ip=0.0.0.0 --no-browser --NotebookApp.token='' --NotebookApp.disable_check_xsrf=True /book/"]
......@@ -37,4 +57,4 @@ 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 .
docker build --no-cache -t paddlepaddle/book:${paddle_version} -t paddlepaddle/book:${latest_label} -f ./build/Dockerfile .
......@@ -5,14 +5,14 @@ if [ $? -ne 0 ]; then
exit 1
fi
GOPATH=~/.go go get -u github.com/wangkuiyi/ipynb/markdown-to-ipynb
GOPATH=~/.cache/go go get -u github.com/wangkuiyi/ipynb/markdown-to-ipynb
cur_path="$(cd "$(dirname "$0")" && pwd -P)"
cd $cur_path/../
#convert md to ipynb
for file in */{README,README\.en}.md ; do
/tmp/go/bin/markdown-to-ipynb < $file > ${file%.*}".ipynb"
~/.cache/go/bin/markdown-to-ipynb < $file > ${file%.*}".ipynb"
if [ $? -ne 0 ]; then
echo >&2 "markdown-to-ipynb $file error"
exit 1
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册