Skip to content

feat: local deployment with Docker #1544

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM rust:1.87-slim-bookworm AS builder

ENV CARGO_HOME=/usr/local/cargo
RUN cargo install mdbook

WORKDIR /app
COPY . .
RUN mdbook build --dest-dir /book

FROM nginx:alpine
COPY --from=builder /book /usr/share/nginx/html
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,17 @@

总之在写作过程中我们始终铭记初心:为中国用户打造一门**全面的、深入的、持续更新的** Rust 教程。 新手用来入门,老手用来提高,高手用来提升生产力。

### docker

使用 docker 部署本教程:

```sh
docker build -t rust-course .
docker-compose up -d
```

随后即可通过浏览器在 http://localhost:3001 中阅读。

## 🏆 贡献者

非常感谢本教程的[所有贡献者](https://github.com/sunface/rust-course/graphs/contributors),正是有了你们,才有了现在的高质量 Rust 教程!
Expand Down
7 changes: 7 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
services:
web:
image: rust-course:latest
container_name: rust-course
ports:
- 3001:80
restart: unless-stopped