This package helps you build and publish a book with Python code, or Python package documents with tutorials.
The differences are
- the document is available at docs/
- you can upload by any systems with docker.
- the docker is automatedly upload by gitflows.(now # push)
d2lbook2 deploy html
can commit by your comment.
TODO: Understand
pip install -U git+https://github.com/aieye-top/d2l-book2.git@master#egg=d2lbook2
https://book.d2l.ai/user/deploy.html
The only difference is
d2lbook2 deploy html
instead of d2lbook deploy html
For this example, the URL is https://github.com/aieye-top/d2cl
The result: https://aieye-top.github.io/d2cl/
https://github.com/ykxVK8yL5L/6pan/blob/main/.github/workflows/docker-image.yml https://www.youtube.com/watch?v=fSKbUgRL3vA
docker pull stevenjokes/d2l-book2:latest
docker pull registry.cn-shanghai.aliyuncs.com/csq-dl/d2l-book2:latest
(base) PS C:\Users\a8679> docker run registry.cn-shanghai.aliyuncs.com/csq-dl/d2l-book2:latest usage: d2lbook2 [-h] {build,deploy,clear,activate,translate}
D2L Book: Publish a book based on Jupyter notebooks. Run d2lbook2 command -h to get the help message for each command.
positional arguments: {build,deploy,clear,activate,translate}
optional arguments: -h, --help show this help message and exit
docker run --rm --name d2cl-whole -ditv /d/onedrive/Documents/read/d2cl-whole:/d2lbook2/d2cl-whole registry.cn-shanghai.aliyuncs.com/csq-dl/d2l-book2:latest /bin/bash
- --rm: 在容器终止运行后自动删除容器文件
- --name: 给他指定了一个d2cl-whole名
- -d: 后台运行容器,并返回容器ID;
- -i: 以交互模式运行容器,通常与 -t 同时使用;
- -t: 为容器重新分配一个伪输入终端,通常与 -i 同时使用;
- -v: 把Win10宿主机的/d/onedrive/Documents/read/d2cl-whole/下载目录挂载到registry.cn-shanghai.aliyuncs.com/csq-dl/d2l-book2:latest容器的/d2lbook2目录下。
docker exec -it d2cl-whole /bin/bash
后来用了for win,就解决了
ls
应该能看到d2cl-whole
cd "/d2lbook2/d2cl-whole/d2cl"
d2lbook2 build html;d2lbook2 deploy html
此时还没连上GitHub 不信可以 ssh -T [email protected]
在deploy之前给ssh
在容器里:
mkdir "/root/.ssh/"
docker cp "C:\Users\a8679\.ssh\id_rsa.pub" d2cl-whole:/root/.ssh/id_rsa.pub
docker cp "C:\Users\a8679\.ssh\id_rsa" d2cl-whole:/root/.ssh/id_rsa
在容器里: Keys need to be only readable by you:
chmod 400 ~/.ssh/id_rsa
d2lbook2 deploy html
要登录用户名密钥,缓存
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
(not working...now!)
git config --global credential.helper cache
#进入容器后,就可以修改镜像了,比如修改镜像中已经部署的代码或者安装新的软件或包等,修改完成之后,exit 退出容器
保存
docker commit -m "github" d2cl-whole
来将id为your-container-id的容器创建成一个镜像快照。
接着,你通过docker images就可以查看到刚刚创建好的镜像快照了。
通过docker tag命令,能够为未命名的镜像指定镜像名
然后,通过:
docker tag f21d7e064f54 registry.cn-shanghai.aliyuncs.com/csq-dl/d2l-book2:github
docker run --rm --name d2cl-whole -ditv /d/onedrive/Documents/read/d2cl-whole:/d2lbook2/d2cl-whole registry.cn-shanghai.aliyuncs.com/csq-dl/d2l-book2:github /bin/bash
docker run --rm --name 2bPM -e HTTP_PROXY=127.0.0.1:1080 -ditv /d/onedrive/Documents/read/2bPM:/d2lbook2/2bPM registry.cn-shanghai.aliyuncs.com/csq-dl/d2l-book2:description /bin/bash
docker exec -it 2bPM /bin/bash
description版已经实现自动复制到rst