Code Monkey home page Code Monkey logo

d2l-book2's Introduction

D2L-Book2: A Toolkit for Hands-on Books

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 htmlcan commit by your comment.

TODO: Understand

Install:

pip install -U git+https://github.com/aieye-top/d2l-book2.git@master#egg=d2lbook2

https://book.d2l.ai/user/deploy.html

To deploy to Github

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/

Docker

https://github.com/ykxVK8yL5L/6pan/blob/main/.github/workflows/docker-image.yml https://www.youtube.com/watch?v=fSKbUgRL3vA

Not China:

docker pull stevenjokes/d2l-book2:latest

国内:

docker pull registry.cn-shanghai.aliyuncs.com/csq-dl/d2l-book2:latest

pull


用例:

(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

run

deploy to github

此时还没连上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

1 2 3

whole whole2

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

PROXY

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

Image

description版已经实现自动复制到rst

d2l-book2's People

Contributors

stevenjokess avatar

Stargazers

Kaya avatar chen avatar  avatar Linna An avatar Thomas avatar  avatar  avatar Ruitao Wei avatar Li Jiazheng avatar Chen avatar liubocheng avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.