index : static-web-server.git

ascending towards madness

author Jose Quintana <joseluisquintana20@gmail.com> 2023-04-30 22:42:03.0 +00:00:00
committer Jose Quintana <joseluisquintana20@gmail.com> 2023-04-30 22:42:03.0 +00:00:00
commit
6876a75e1ea2e25f7973f1cc614f76bd80b5d16c [patch]
tree
5c8006ce6fe87bf42722196c0f419df3531d9713
parent
e0ae5a7aea6f90ca37024140d4ff5e2670d80591
download
6876a75e1ea2e25f7973f1cc614f76bd80b5d16c.tar.gz

docs: enable content editing option and revision [skip ci]



Diff

 .gitignore              |  1 +
 Makefile                |  8 +++++++-
 docs/Dockerfile         | 17 +++++++++++++++++
 docs/docker-compose.yml |  9 +++++++--
 docs/entrypoint.sh      | 10 ++++++++++
 docs/mkdocs.yml         | 15 ++++++++++++++-
 6 files changed, 56 insertions(+), 4 deletions(-)

diff --git a/.gitignore b/.gitignore
index db80c83..bc2d87e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -25,6 +25,7 @@ TODO
docs/site
docs/*/**.html
*/**/*.1
docs/docs

!/docs
!/tests/fixtures/**/*
diff --git a/Makefile b/Makefile
index 6c0e639..f092fec 100644
--- a/Makefile
+++ b/Makefile
@@ -262,7 +262,13 @@ docs-deploy:
	@git stash
	@rm -rf /tmp/docs
	@mkdir -p /tmp/docs
	@docker run -it --rm -v $(PWD)/docs:/docs -v /tmp/docs:/tmp/docs squidfunk/mkdocs-material build
	@docker-compose -f docs/docker-compose.yml build
	@docker run -it --rm \
		-v $(PWD)/.git:/docs/.git \
		-v $(PWD)/docs/content:/docs/docs/content \
		-v $(PWD)/docs/mkdocs.yml:/docs/mkdocs.yml \
		-v /tmp/docs:/tmp/docs \
			static-web-server-docs mkdocs build
	@git checkout gh-pages
	@git clean -fdx
	@cp -rf docs/CNAME /tmp/docs/
diff --git a/docs/Dockerfile b/docs/Dockerfile
new file mode 100644
index 0000000..49a0e61
--- /dev/null
+++ b/docs/Dockerfile
@@ -0,0 +1,17 @@
FROM squidfunk/mkdocs-material

RUN set -eux \
    && apk upgrade --update-cache -a \
    && pip3 install \
        mkdocs-git-revision-date-localized-plugin \
    && true

COPY ./entrypoint.sh /

WORKDIR /docs

EXPOSE 8000

ENTRYPOINT ["/entrypoint.sh"]

CMD ["mkdocs", "serve", "--dev-addr=0.0.0.0:8000"]
diff --git a/docs/docker-compose.yml b/docs/docker-compose.yml
index 1e5f2bd..373ce17 100644
--- a/docs/docker-compose.yml
+++ b/docs/docker-compose.yml
@@ -1,8 +1,13 @@
version: "3.3"
services:
  server:
    image: squidfunk/mkdocs-material
    container_name: static-web-server-docs
    image: static-web-server-docs
    build:
      dockerfile: Dockerfile
    ports:
      - 8000:8000
    volumes:
      - ./:/docs
      - ../.git:/docs/.git
      - ./content:/docs/docs/content
      - ./mkdocs.yml:/docs/mkdocs.yml
diff --git a/docs/entrypoint.sh b/docs/entrypoint.sh
new file mode 100755
index 0000000..f34443a
--- /dev/null
+++ b/docs/entrypoint.sh
@@ -0,0 +1,10 @@
#!/bin/sh

set -e

# Check if incoming command contains flags.
if [ "${1#-}" != "$1" ]; then
    set -- mkdocs "$@"
fi

exec "$@"
diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml
index b8ea386..d4e6b4b 100644
--- a/docs/mkdocs.yml
+++ b/docs/mkdocs.yml
@@ -10,7 +10,7 @@ repo_name: static-web-server/static-web-server
repo_url: https://github.com/static-web-server/static-web-server/
edit_uri: edit/master/docs/content/

docs_dir: 'content'
docs_dir: 'docs/content'
site_dir: '/tmp/docs'
extra_css:
  - 'assets/style.css'
@@ -26,6 +26,8 @@ theme:
  include_sidebar: true
  features:
    - content.code.annotate
    - content.action.edit
    - content.action.view
    - content.tabs.link
    - header.autohide
    # - navigation.expand
@@ -112,6 +114,17 @@ plugins:
  - search
  - minify:
      minify_html: true
  - git-revision-date-localized:
      type: timeago
      custom_format: "%d. %B %Y"
      timezone: Europe/Berlin
      locale: en
      fallback_to_build_date: false
      enable_creation_date: false
      exclude:
        - index.md
      enabled: true
      strict: true

# Content Navigation
nav: