index : static-web-server.git

ascending towards madness

author Jose Quintana <joseluisquintana20@gmail.com> 2022-03-30 8:49:55.0 +00:00:00
committer Jose Quintana <joseluisquintana20@gmail.com> 2022-03-30 8:49:55.0 +00:00:00
commit
e52c038c4c8f7814455b1c926711a7c09b17c5e2 [patch]
tree
17f2bb66a1f51fea53ee0f8e34788cef1b057cc2
parent
fa05773b9b8e12b9d82b8cda1f9d68425ca225bc
download
e52c038c4c8f7814455b1c926711a7c09b17c5e2.tar.gz

docs: building documentation from source [skip ci]



Diff

 docs/Dockerfile                      |  1 +-
 docs/README.md                       |  3 ++-
 docs/content/building-from-source.md | 45 +++++++++++++++++++++++++++++++++----
 docs/docker-compose.yml              |  4 +---
 4 files changed, 45 insertions(+), 8 deletions(-)

diff --git a/docs/Dockerfile b/docs/Dockerfile
deleted file mode 100644
index 445fb64..0000000
--- a/docs/Dockerfile
+++ /dev/null
@@ -1 +0,0 @@
FROM squidfunk/mkdocs-material
diff --git a/docs/README.md b/docs/README.md
new file mode 100644
index 0000000..1691bda
--- /dev/null
+++ b/docs/README.md
@@ -0,0 +1,3 @@
# Build or improve documentation

To build or improve the documentation follow the [building documentation from source]https://sws.joseluisq.net/building-from-source/#building-documentation-from-source instructions.
diff --git a/docs/content/building-from-source.md b/docs/content/building-from-source.md
index 1d12c07..1334708 100644
--- a/docs/content/building-from-source.md
+++ b/docs/content/building-from-source.md
@@ -1,8 +1,12 @@
# Building from Source

If you want to build **`SWS`** from source, all what you need is to have a [Rust 2021 Edition]https://blog.rust-lang.org/2021/05/11/edition-2021.html installed.
Follow these instructions to either build **`SWS`** project from source or the HTML documentation.

Make sure to install Rust [1.56.0]https://blog.rust-lang.org/2021/10/21/Rust-1.56.0.html or higher (or nightly) along with [the toolchain(s)]https://rust-lang.github.io/rustup/concepts/toolchains.html of your preference.
## Building project from source

If you want to build **`SWS`** from source, all you need is a [Rust 2021 Edition]https://blog.rust-lang.org/2021/05/11/edition-2021.html installed.

So make sure to install Rust [1.56.0]https://blog.rust-lang.org/2021/10/21/Rust-1.56.0.html or higher (or nightly) along with [the toolchain(s)]https://rust-lang.github.io/rustup/concepts/toolchains.html of your preference.

Then clone the repository and use [Cargo]https://doc.rust-lang.org/cargo/ to build the project from source.

@@ -12,8 +16,41 @@ cd static-web-server
cargo build --release
```

Finally, the release binary should be available at `target/release/static-web-server`.
Finally, the release binary should be available at `target/release/static-web-server` or under your toolchain directory chosen.

!!! info "Note"
!!! info "Don't use the project's `Makefile`"
    Please don't use the project's `Makefile` since it's only intended for development and some on-demand tasks.

## Building documentation from source

All HTML documentation is located in `docs/` project's directory and is built using [Material for MkDocs]https://github.com/squidfunk/mkdocs-material.

It's only necessary to have [Docker]https://www.docker.com/get-started/ installed.

### Building documentation

By default the docs will be built in `/tmp/docs` directory, to do so follow these steps.

```sh
git clone https://github.com/joseluisq/static-web-server.git
cd static-web-server
mkdir /tmp/docs
docker run -it --rm \
    -v $PWD/docs:/docs \
    -v /tmp/docs:/tmp/docs squidfunk/mkdocs-material build
```

!!! tip "Output the docs in a different directory"
    If you want to output the docs in a different directory then append the `--site-dir=/new/dir/path/` argument to the *"squidfunk/mkdocs-material"* `build` command and make sure to provide the new directory path.

### Development server

If you want to improve the documentation then run the built-in development server via `docs/docker-compose.yml`.

```sh
git clone https://github.com/joseluisq/static-web-server.git
cd static-web-server
docker-compose -f docs/docker-compose.yml up
```

Now the server will be available at `localhost:8000`
diff --git a/docs/docker-compose.yml b/docs/docker-compose.yml
index 021484e..1e5f2bd 100644
--- a/docs/docker-compose.yml
+++ b/docs/docker-compose.yml
@@ -1,9 +1,7 @@
version: "3.3"
services:
  server:
    build:
      context: .
      dockerfile: Dockerfile
    image: squidfunk/mkdocs-material
    ports:
      - 8000:8000
    volumes: