From cf067a9c470f0b81c075dd44a65e80bc18a2194b Mon Sep 17 00:00:00 2001 From: Jamie Holdstock Date: Fri, 24 Mar 2023 11:46:34 +0000 Subject: [PATCH] Use mkdocs-material 9. (#108) * Use mkdocs-material 9. Bumping major version of mkdocs to 9. It includes some nice improvements to search but nothing else relevant to our docs. Also picking up python 3.11 and nginx 1.22. * build: Docker cleanup/update. - Use Alpine version of nginx image (23MB instead of 142MB) - Fix MIME type for rss feeds. - Clean up .gitignore and .dockerignore. - Ensure scripts fail on error. --- .dockerignore | 12 +++++++----- .github/workflows/python.yml | 2 +- Dockerfile | 4 ++-- LICENSE | 2 +- bin/build.sh | 18 +++++++++++++----- bin/build_docs.sh | 4 +++- conf/nginx.conf | 14 ++++++++------ docs/css/style.css | 3 ++- mkdocs.yml | 2 +- requirements.txt | 2 +- 10 files changed, 39 insertions(+), 24 deletions(-) diff --git a/.dockerignore b/.dockerignore index 38577a8..a0c1ad1 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,7 +1,9 @@ -bin/build.sh -Dockerfile -README.md -.git .gitignore +.git +.github +LICENSE +README.md -site/ +bin/build.sh +site +.cache diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 53b11fd..fea9654 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -6,7 +6,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.9] + python-version: [3.11] steps: - uses: actions/checkout@v2 diff --git a/Dockerfile b/Dockerfile index dd534c3..7b96514 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Build image -FROM python:3.9 +FROM python:3.11 LABEL description="dcrdevdocs build" LABEL version="1.0" @@ -18,7 +18,7 @@ RUN pip install mkdocs && \ RUN ./bin/build_docs.sh # Serve image (stable nginx version) -FROM nginx:1.20 +FROM nginx:1.22-alpine LABEL description="dcrdevdocs serve" LABEL version="1.0" diff --git a/LICENSE b/LICENSE index 925f514..5df4e4f 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ ISC License -Copyright (c) 2018-2021 The Decred developers +Copyright (c) 2018-2023 The Decred developers Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above diff --git a/bin/build.sh b/bin/build.sh index c18c0bc..6419efa 100755 --- a/bin/build.sh +++ b/bin/build.sh @@ -1,13 +1,21 @@ -#!/bin/bash -e +#!/usr/bin/env bash # Requires docker 17.05 or higher +set -e + echo "" -echo "=================================" +echo "====================================" echo " Building dcrdevdocs docker image " -echo "=================================" +echo "====================================" echo "" -docker build -t decred/dcrdevdocs . +IMAGE_NAME=decred/dcrdevdocs + +if [ "$1" != "" ]; then + IMAGE_NAME=$1 +fi + +docker build -t $IMAGE_NAME . echo "" echo "===================" @@ -15,5 +23,5 @@ echo " Build complete" echo "===================" echo "" echo "You can now run dcrdevdocs with the following command:" -echo " docker run -d --rm -p :80 decred/dcrdevdocs:latest" +echo " docker run -d --rm -p :80 $IMAGE_NAME:latest" echo "" diff --git a/bin/build_docs.sh b/bin/build_docs.sh index 20c7303..5153772 100755 --- a/bin/build_docs.sh +++ b/bin/build_docs.sh @@ -1,4 +1,6 @@ -#!/bin/bash -e +#!/usr/bin/env bash + +set -e echo "" echo "=========================================" diff --git a/conf/nginx.conf b/conf/nginx.conf index d79c6ec..d4ed68a 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -13,13 +13,15 @@ server { server_name localhost; charset utf-8; + + # Hide Version server_tokens off; - #Security Headers - add_header X-Content-Type-Options "nosniff" always; - add_header X-Frame-Options "DENY" always; - add_header X-XSS-Protection "1; mode=block" always; - add_header Referrer-Policy "no-referrer" always; + # Security Headers + add_header X-Content-Type-Options "nosniff" always; + add_header X-Frame-Options "DENY" always; + add_header X-XSS-Protection "1; mode=block" always; + add_header Referrer-Policy "no-referrer" always; location / { root /usr/share/nginx/html; @@ -38,6 +40,6 @@ server { gzip_comp_level 6; gzip_buffers 16 8k; gzip_http_version 1.1; - gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss image/svg+xml text/javascript; + gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/rss+xml image/svg+xml text/javascript; } diff --git a/docs/css/style.css b/docs/css/style.css index 8ef08e8..e760e4a 100644 --- a/docs/css/style.css +++ b/docs/css/style.css @@ -153,7 +153,8 @@ details .md-typeset__table code{ font-size: 13px; } -.md-typeset .admonition p{ +.md-typeset .admonition p, +.md-typeset .admonition li { font-size: 14px; } diff --git a/mkdocs.yml b/mkdocs.yml index d81dbf8..d94eecb 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -116,4 +116,4 @@ nav: - 'Regnet': 'environments/regnet.md' - Contributing: - 'Contributor Guidelines': 'contributing/contributor-guidelines.md' -copyright: If you wish to improve this site, please open an issue or send a pull request.
dcrdevdocs v0.0.1. Decred Project 2020. +copyright: If you wish to improve this site, please open an issue or send a pull request.
dcrdevdocs v0.0.1. Decred Project 2020-2023. diff --git a/requirements.txt b/requirements.txt index e20a1a5..2afedc3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ -mkdocs-material==8.2.8 +mkdocs-material==9.0.6 mkdocs-markdownextradata-plugin==0.2.4