Sign inSign up

buvis/mkdocs-git-sync

By buvis

•Updated 6 months ago

Run MkDocs site in Docker and have it automatically synced from the source git repository.

Image
0

10K+

buvis/mkdocs-git-sync repository overview

⁠Purpose

Build MkDocs site in Docker and have it automatically synced from the source git repository.

⁠Run

This image only builds the site to container's /app/site directory. Use Docker Compose to run nginx web server to host the site.

  1. Create file docker-compose.yml
  version: '3'

  services:
    syncer:
      image: buvis/mkdocs-git-sync
      environment:
        - GIT_REPO=https://github.com/buvis/mkdocs-zettelkasten.git
        - GIT_BRANCH=main
        - UPDATE_INTERVAL=60
      volumes:
        - ./config/syncer:/app/config
        - site:/app/site
    nginx:
      image: nginx
      ports:
        - 8000:80
      volumes:
        - ./config/nginx:/etc/nginx/conf.d
        - site:/site
      depends_on:
        - syncer
  volumes:
    site:
  1. Copy https://github.com/buvis/container-images/tree/main/apps/mkdocs-git-sync/config to config directory
  2. Run Docker Compose
docker-compose up

This will run two services: syncer built from the Dockerfile in this repository and nginx web server. They share site volume, where syncer outputs the site built by MkDocs and nginx serves it from there.

Once started, navigate to http://127.0.0.1:8000⁠. You will see MkDocs Zettelkasten documentation generated from its repository⁠

⁠Configure

⁠Files
⁠Environment variables
  • GIT_CREDENTIALS: if using a private repo, use this variable to pass <username>:<password> or <token_name>:<token>
  • GIT_REPO: source of markdown files for MkDocs build
  • GIT_BRANCH: repository's branch to use (default: main)
  • UPDATE_INTERVAL: pull from repository every x seconds (default: 900)
  • LOG_LEVEL: logging library⁠ minimum message level to be logged (default: INFO)

Tag summary

Content type

Image

Digest

sha256:892800fc6…

Size

30.8 MB

Last updated

6 months ago

docker pull buvis/mkdocs-git-sync