Skip to content

Commit

Permalink
Merge pull request krahets#223 from xiongsp/master
Browse files Browse the repository at this point in the history
feat: update Dockerfile to deploy
  • Loading branch information
krahets authored Jan 12, 2023
2 parents 48d1629 + ebf049f commit abcdf1b
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM python:3.9.0-alpine

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"]
7 changes: 7 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: '3'
services:
hello-algo:
build: .
ports:
- "8000:8000"

22 changes: 22 additions & 0 deletions docs/chapter_preface/contribution.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:教学视频)

0 comments on commit abcdf1b

Please sign in to comment.