-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (25 loc) · 748 Bytes
/
Copy pathDockerfile
File metadata and controls
36 lines (25 loc) · 748 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Use the latest Rust image to build mdBook
FROM rust:latest AS builder
# Install mdBook
RUN cargo install mdbook
# Create app directory
WORKDIR /app
# Clone the GitHub repository (replace with your repo URL)
# ARG REPO_URL=<your-repo-url>
# RUN git clone $REPO_URL .
# Copy the book source (if using a local directory, uncomment this line and comment the git clone above)
COPY . .
# Build the book
RUN mdbook build
# Use a small web server to serve the book
FROM alpine:latest
# Install a simple HTTP server
RUN apk add --no-cache darkhttpd
# Copy the built book from the builder
COPY --from=builder /app/book /book
# Expose port
EXPOSE 8080
# We run as a user
USER nonroot
# Serve the book
CMD ["darkhttpd", "/book", "--port", "8080"]