forked from pozgo/docker-mkdocs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: Added support for git based documentation (pozgo#33)
- Loading branch information
Showing
10 changed files
with
142 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,23 +19,26 @@ MkDocs is a fast, simple and downright gorgeous static site generator that's gea | |
|
||
Purpose of this image was to simplify the process of deploying MkDocs. This image is based on Alpine Linux to minimize the size of the image. | ||
|
||
Workdir is set to `/mkdocs` | ||
|
||
**This container requires `workdir` to be set on runtime either using simple `docker run -w /my_workdir` or with `docker-compose.yaml`** | ||
It have to match mounted directory path from `DOCS_DIRECTORY` environmental variable | ||
|
||
```yaml | ||
version: '3' | ||
|
||
services: | ||
mkdocs: | ||
container_name: mkdocs | ||
image: polinux/mkdocs:latest | ||
image: polinux/mkdocs:1.1.0 | ||
restart: always | ||
ports: | ||
- "8000:8000" | ||
environment: | ||
LIVE_RELOAD_SUPPORT: 'true' | ||
ADD_MODULES: 'fontawesome-markdown mkdocs-git-revision-date-localized-plugin mkdocs-material' | ||
FAST_MODE: 'true' | ||
DOCS_DIRECTORY: '/mkdocs' | ||
GIT_REPO: '[email protected]:username/docs.git' | ||
UPDATE_INTERVAL: 15 | ||
AUTO_UPDATE: 'true' | ||
volumes: | ||
- ${PWD}/mkdocs:/mkdocs | ||
working_dir: /mkdocs | ||
- $HOME/.ssh/id_rsa:/root/.ssh/id_rsa | ||
``` | ||
### Environmental Variables | ||
|
@@ -46,6 +49,10 @@ services: | |
|`ADD_MODULES`|List of module to install.|`false`| | ||
|`FAST_MODE`|Enable fast mode. Rebuilds only changed/added files|`false`| | ||
|`DOCS_DIRECTORY`|Directory in which documentation is mounted inside of container|`/mkdocs`| | ||
|`GIT_REPO`|Repository address. Will require ssh key for ssh connection. Example: `-v ${HOME}/.ssh/id_rsa:/root/.ssh/id_rsa`|`false`| | ||
|`GIT_BRANCH`|Self explanatory|`master`| | ||
|`AUTO_UPDATE`|Auto update for git repository support|`false`| | ||
|`UPDATE_INTERVAL`|Update interval in *minutes* - used only when `AUTO_UPDATE` set to `true`|every `15` minutes| | ||
|
||
### Usage | ||
|
||
|
@@ -55,8 +62,8 @@ docker run \ | |
--name mkdocs \ | ||
polinux/mkdocs | ||
``` | ||
Mount Volume into working directory and make it available on port `80` on `localhost` and additional themes. | ||
|
||
Custom config with `git` repository as source of documentation | ||
```bash | ||
docker run \ | ||
-ti \ | ||
|
@@ -65,12 +72,36 @@ docker run \ | |
-e "ADD_MODULES=mkdocs-bootstrap mkdocs-gitbook mkdocs-bootstrap4" \ | ||
-e "LIVE_RELOAD_SUPPORT=true" \ | ||
-e "FAST_MODE=true" \ | ||
-e "DOCS_DIRECTORY=/workdir" \ | ||
-v /my_docs_dir:/workdir \ | ||
-e "DOCS_DIRECTORY=/my_docs" \ | ||
-e "GIT_REPO=https://my_repos/custom-docs.git" \ | ||
-e "GIT_BRANCH=develop" \ | ||
-e "AUTO_UPDATE=true" \ | ||
-e "UPDATE_INTERVAL=1" \ | ||
-v ${HOME}/.ssh/id_rsa:/root/.ssh/id_rsa \ | ||
polinux/mkdocs | ||
``` | ||
|
||
Docker Compose file contains default settings for deploying in local directory and it's set to bind port `8000` to localhost. | ||
See `docker-compose.yaml` for all compose options examples | ||
|
||
### Update git repo based deployment | ||
Assuming you are using git repository as source of documentation there are two options available for updating the content of the docs. | ||
|
||
#### Manual | ||
|
||
Assuming that container name is `mkdocs` | ||
```bash | ||
docker exec -ti mkdocs bootstrap update | ||
Pulled branch: master | ||
Commit: a4000c525f6db977777bf758987c4df0b44f59b4 | ||
Commit Message: Updated nodejs | ||
Date: 2020-03-24 18:52:43 | ||
Author: Przemek Ozgo | ||
``` | ||
|
||
#### AUTO_UPDATE | ||
there are two environmental variables that can be used for AUTO UPDATE. | ||
See table above ^^ | ||
|
||
|
||
### Build | ||
|
||
|
@@ -112,4 +143,4 @@ docker history --no-trunc=true polinux/mkdocs | tr -s ' ' | tail -n+2 | awk -F " | |
Przemyslaw Ozgo | ||
|
||
## License | ||
[](https://app.fossa.io/projects/git%2Bgithub.com%2Fpozgo%2Fdocker-mkdocs?ref=badge_large) | ||
[](https://app.fossa.io/projects/git%2Bgithub.com%2Fpozgo%2Fdocker-mkdocs?ref=badge_large) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Host * | ||
StrictHostKeyChecking no |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ version: '3' | |
services: | ||
mkdocs: | ||
container_name: mkdocs | ||
image: polinux/mkdocs:latest | ||
image: polinux/mkdocs:1.1.0 | ||
restart: always | ||
ports: | ||
- "8000:8000" | ||
|
@@ -12,6 +12,8 @@ services: | |
ADD_MODULES: 'fontawesome-markdown mkdocs-git-revision-date-localized-plugin mkdocs-material' | ||
FAST_MODE: 'true' | ||
DOCS_DIRECTORY: '/mkdocs' | ||
GIT_REPO: '[email protected]:username/docs.git' | ||
UPDATE_INTERVAL: 15 | ||
AUTO_UPDATE: 'true' | ||
volumes: | ||
- ${PWD}/mkdocs:/mkdocs | ||
working_dir: /mkdocs | ||
- $HOME/.ssh/id_rsa:/root/.ssh/id_rsa |