Skip to content

Commit

Permalink
Use mkdocs-material 9. (#108)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
jholdstock committed Mar 24, 2023
1 parent 753796c commit cf067a9
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 24 deletions.
12 changes: 7 additions & 5 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
bin/build.sh
Dockerfile
README.md
.git
.gitignore
.git
.github
LICENSE
README.md

site/
bin/build.sh
site
.cache
2 changes: 1 addition & 1 deletion .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9]
python-version: [3.11]

steps:
- uses: actions/checkout@v2
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build image
FROM python:3.9
FROM python:3.11

LABEL description="dcrdevdocs build"
LABEL version="1.0"
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -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
Expand Down
18 changes: 13 additions & 5 deletions bin/build.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
#!/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 "==================="
echo " Build complete"
echo "==================="
echo ""
echo "You can now run dcrdevdocs with the following command:"
echo " docker run -d --rm -p <local port>:80 decred/dcrdevdocs:latest"
echo " docker run -d --rm -p <local port>:80 $IMAGE_NAME:latest"
echo ""
4 changes: 3 additions & 1 deletion bin/build_docs.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/bin/bash -e
#!/usr/bin/env bash

set -e

echo ""
echo "========================================="
Expand Down
14 changes: 8 additions & 6 deletions conf/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

}
3 changes: 2 additions & 1 deletion docs/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <a href="https://github.com/decred/dcrdevdocs/issues/new">open an issue</a> or <a href="https://github.com/decred/dcrdevdocs/compare">send a pull request</a>.<br />dcrdevdocs v0.0.1. Decred Project 2020.
copyright: If you wish to improve this site, please <a href="https://github.com/decred/dcrdevdocs/issues/new">open an issue</a> or <a href="https://github.com/decred/dcrdevdocs/compare">send a pull request</a>.<br />dcrdevdocs v0.0.1. Decred Project 2020-2023.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
mkdocs-material==8.2.8
mkdocs-material==9.0.6
mkdocs-markdownextradata-plugin==0.2.4

0 comments on commit cf067a9

Please sign in to comment.