Skip to content

Add Docker support as an optional alternative to GitHub Pages #115

Description

@AleBera03

Feature request

Add Dockerfile and docker-compose.yml to the repo root or within subfolder docker to support
running the built site as a self-contained container.

This feature is not intented for aiming local development (native cargo xtasks serve is enough), but it would introduce an alternative deployment method without relying on github.io upstream. The simplest solution is building a container which wraps cargo xtasks serve as a service. Another option is using an external image which hosts /docs page after cargo xtasks deploy command

A possible solution

  • Multi-stage Dockerfile:
    • Builder stage: rust:1-slim-bookworm, installs mdbook + mdbook-mermaid,
      builds xtask in release mode.
    • Runtime stage: debian:bookworm-slim, copies only the built binaries
      (xtask, mdbook, mdbook-mermaid) — no Rust toolchain in the final image.
    • CMD ["xtask", "serve"], binds 0.0.0.0:3000 via XTASK_BIND env var.
  • docker-compose.yml exposing port 3000, with a healthcheck against the
    running server and restart: unless-stopped.

This solution is temporary and can be improved. If the feature is interesting, I would be happy to open a PR with the implemented integration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions