Merge pull request #223 from xiongsp/master
feat: update Dockerfile to deploy
This commit is contained in:
commit
abcdf1b234
16
Dockerfile
Normal file
16
Dockerfile
Normal file
@ -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
docker-compose.yml
Normal file
7
docker-compose.yml
Normal file
@ -0,0 +1,7 @@
|
||||
version: '3'
|
||||
services:
|
||||
hello-algo:
|
||||
build: .
|
||||
ports:
|
||||
- "8000:8000"
|
||||
|
@ -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:教学视频)
|
||||
|
Loading…
x
Reference in New Issue
Block a user