From 80c5a0472af1c57e930ccde1238700179931067e Mon Sep 17 00:00:00 2001 From: xiongsp <37035570+xiongsp@users.noreply.github.com> Date: Sun, 8 Jan 2023 23:22:01 +0800 Subject: [PATCH 1/6] update Docker --- Dockerfile | 20 ++++++++++++++++++++ docker-compose.yml | 7 +++++++ 2 files changed, 27 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..5d437c846 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +FROM python:3.9.0-buster + +RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list +RUN sed -i 's/security.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list + +RUN pip install --upgrade pip && pip install mkdocs mkdocs-material + +WORKDIR /app + +COPY codes /app/codes + +COPY docs /app/docs + +COPY mkdocs.yml /app/mkdocs.yml + +RUN mkdir ./docs/overrides && mkdocs build + +EXPOSE 8000 + +CMD ["mkdocs", "serve", "-a", "0.0.0.0:8000"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..6a472b173 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,7 @@ +version: '3' +services: + hello-algo: + build: . + ports: + - "8000:8000" + \ No newline at end of file From 777370a5f8ffb3e417f51699a1077cc4b679daad Mon Sep 17 00:00:00 2001 From: xiongsp <37035570+xiongsp@users.noreply.github.com> Date: Tue, 10 Jan 2023 12:12:10 +0800 Subject: [PATCH 2/6] Add instruction --- Dockerfile | 5 +---- README.md | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5d437c846..9d566fbe2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,6 @@ FROM python:3.9.0-buster -RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list -RUN sed -i 's/security.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list - -RUN pip install --upgrade pip && pip install mkdocs mkdocs-material +RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --upgrade pip && pip install -i https://pypi.tuna.tsinghua.edu.cn/simple mkdocs mkdocs-material WORKDIR /app diff --git a/README.md b/README.md index 560e73953..8bb7b345d 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,28 @@ 如果感觉本书对你有所帮助,请点个 Star :star: 支持一下,谢谢! +### 本地部署 + +#### Docker + +使用本教程前,请确保Docker已经安装并启动。 + +根据如下命令离线部署。 + +```bash +git clone https://github.com/krahets/hello-algo.git +cd hello-algo +docker-compose up -d +``` + +稍等片刻,请访问`http://localhost:8000`即可访问本教程。 + +使用如下命令删除部署。 + +```bash +docker-compose down +``` + ## 推荐语 > “一本通俗易懂的数据结构与算法入门书,引导读者手脑并用地学习,强烈推荐算法初学者阅读。” From 38a3d913edf621ba3c968266d60832a5723b0daf Mon Sep 17 00:00:00 2001 From: xiongsp <37035570+xiongsp@users.noreply.github.com> Date: Tue, 10 Jan 2023 12:47:40 +0800 Subject: [PATCH 3/6] optimize the Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 9d566fbe2..813b4a37f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.9.0-buster +FROM python:3.9.0-alpine RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --upgrade pip && pip install -i https://pypi.tuna.tsinghua.edu.cn/simple mkdocs mkdocs-material From d1315f5cdcfcf2c0e760a61acf4cf84a33b2f74d Mon Sep 17 00:00:00 2001 From: Yudong Jin Date: Wed, 11 Jan 2023 03:37:14 +0800 Subject: [PATCH 4/6] Update Dockerfile --- Dockerfile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 813b4a37f..f699e33ea 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,16 @@ FROM python:3.9.0-alpine -RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --upgrade pip && pip install -i https://pypi.tuna.tsinghua.edu.cn/simple mkdocs mkdocs-material +RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --upgrade pip +RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple mkdocs-material==9.0.2 WORKDIR /app COPY codes /app/codes - COPY docs /app/docs - COPY mkdocs.yml /app/mkdocs.yml RUN mkdir ./docs/overrides && mkdocs build EXPOSE 8000 -CMD ["mkdocs", "serve", "-a", "0.0.0.0:8000"] \ No newline at end of file +CMD ["mkdocs", "serve", "-a", "0.0.0.0:8000"] From e6d1f2fd10fc67bb6b9ed722c95043e2b56c6e48 Mon Sep 17 00:00:00 2001 From: xiongsp <37035570+xiongsp@users.noreply.github.com> Date: Thu, 12 Jan 2023 10:36:54 +0800 Subject: [PATCH 5/6] Move tutorial to docs --- README.md | 22 ---------------------- docs/chapter_preface/contribution.md | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 8bb7b345d..560e73953 100644 --- a/README.md +++ b/README.md @@ -41,28 +41,6 @@ 如果感觉本书对你有所帮助,请点个 Star :star: 支持一下,谢谢! -### 本地部署 - -#### Docker - -使用本教程前,请确保Docker已经安装并启动。 - -根据如下命令离线部署。 - -```bash -git clone https://github.com/krahets/hello-algo.git -cd hello-algo -docker-compose up -d -``` - -稍等片刻,请访问`http://localhost:8000`即可访问本教程。 - -使用如下命令删除部署。 - -```bash -docker-compose down -``` - ## 推荐语 > “一本通俗易懂的数据结构与算法入门书,引导读者手脑并用地学习,强烈推荐算法初学者阅读。” diff --git a/docs/chapter_preface/contribution.md b/docs/chapter_preface/contribution.md index c710e6de5..892da0b4c 100644 --- a/docs/chapter_preface/contribution.md +++ b/docs/chapter_preface/contribution.md @@ -41,4 +41,26 @@ comments: true 非常欢迎您和我一同来创作本书! +## 离线部署 + +### Docker + +使用本教程前,请确保Docker已经安装并启动。 + +根据如下命令离线部署。 + +```bash +git clone https://github.com/krahets/hello-algo.git +cd hello-algo +docker-compose up -d +``` + +稍等片刻,请访问`http://localhost:8000`即可访问本教程。 + +使用如下命令删除部署。 + +```bash +docker-compose down +``` + (TODO:教学视频) From ebf049f2c6ebb903f67cd1e8c7cb47edfc5a58ef Mon Sep 17 00:00:00 2001 From: Yudong Jin Date: Thu, 12 Jan 2023 13:50:02 +0800 Subject: [PATCH 6/6] Update contribution.md --- docs/chapter_preface/contribution.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/chapter_preface/contribution.md b/docs/chapter_preface/contribution.md index 892da0b4c..4e5f3dc85 100644 --- a/docs/chapter_preface/contribution.md +++ b/docs/chapter_preface/contribution.md @@ -45,7 +45,7 @@ comments: true ### Docker -使用本教程前,请确保Docker已经安装并启动。 +使用本教程前,请确保 Docker 已经安装并启动。 根据如下命令离线部署。 @@ -55,7 +55,7 @@ cd hello-algo docker-compose up -d ``` -稍等片刻,请访问`http://localhost:8000`即可访问本教程。 +稍等片刻,即可通过浏览器打开 `http://localhost:8000` 访问本教程。 使用如下命令删除部署。