Add mdBook documentation with Ghostty-style sidebar
This commit is contained in:
+47
-3
@@ -2,7 +2,39 @@
|
||||
# This reduces the final image size significantly by separating build and runtime
|
||||
|
||||
# ============================================================================
|
||||
# Stage 1: Rust Builder
|
||||
# Stage 1: Documentation Builder
|
||||
# ============================================================================
|
||||
FROM rust:1.91-slim-bookworm AS docs-builder
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
# Install required tools
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends curl ca-certificates && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install mdbook first
|
||||
RUN cargo install mdbook
|
||||
|
||||
# Copy documentation source (includes theme files)
|
||||
COPY docs ./docs
|
||||
|
||||
# Download Catppuccin theme CSS if not already present
|
||||
RUN if [ ! -f docs/theme/catppuccin.css ]; then \
|
||||
curl -fsSL https://github.com/catppuccin/mdBook/releases/latest/download/catppuccin.css \
|
||||
-o docs/theme/catppuccin.css && \
|
||||
echo "Catppuccin CSS downloaded successfully"; \
|
||||
else \
|
||||
echo "Catppuccin CSS already present"; \
|
||||
fi
|
||||
|
||||
# Build documentation
|
||||
RUN cd docs && \
|
||||
mdbook build && \
|
||||
ls -la book/
|
||||
|
||||
# ============================================================================
|
||||
# Stage 2: Rust Builder
|
||||
# ============================================================================
|
||||
FROM rust:1.91-slim-bookworm AS rust-builder
|
||||
|
||||
@@ -29,6 +61,14 @@ RUN mkdir src && \
|
||||
COPY src ./src
|
||||
COPY templates ./templates
|
||||
COPY static ./static
|
||||
COPY build.rs ./build.rs
|
||||
|
||||
# Copy built documentation from docs-builder stage
|
||||
COPY --from=docs-builder /build/docs/book ./static/docs
|
||||
|
||||
# Verify documentation was copied
|
||||
RUN ls -la ./static/docs/ && \
|
||||
test -f ./static/docs/index.html || (echo "ERROR: Documentation index.html not found!" && exit 1)
|
||||
|
||||
# Build the actual application (force rebuild by touching sources)
|
||||
RUN touch src/server.rs src/lib.rs && \
|
||||
@@ -36,7 +76,7 @@ RUN touch src/server.rs src/lib.rs && \
|
||||
strip target/release/webterm-server
|
||||
|
||||
# ============================================================================
|
||||
# Stage 2: Node.js Builder
|
||||
# Stage 3: Node.js Builder
|
||||
# ============================================================================
|
||||
FROM node:20-slim AS node-builder
|
||||
|
||||
@@ -56,7 +96,7 @@ RUN npm ci --only=production && \
|
||||
cp static/favicon.png node_modules/
|
||||
|
||||
# ============================================================================
|
||||
# Stage 3: Runtime Image
|
||||
# Stage 4: Runtime Image
|
||||
# ============================================================================
|
||||
FROM debian:trixie-slim
|
||||
|
||||
@@ -104,6 +144,10 @@ COPY --from=rust-builder /build/target/release/webterm-server /usr/local/bin/web
|
||||
COPY --from=rust-builder /build/templates ./templates
|
||||
COPY --from=rust-builder /build/static ./static
|
||||
|
||||
# Verify documentation is present in static/docs
|
||||
RUN ls -la ./static/docs/ && \
|
||||
test -f ./static/docs/index.html || echo "WARNING: Documentation not found in static/docs"
|
||||
|
||||
# Copy node_modules from node-builder
|
||||
COPY --from=node-builder /build/node_modules ./node_modules
|
||||
|
||||
|
||||
Reference in New Issue
Block a user